You have people*. You have places you want them to be. Go Sync makes it happen.
* Doesn't have to be people.
go get github.com/ovotech/go-sync@latest
# Then get the adapters you need.
go get github.com/ovotech/go-sync/adapters/slack@latest
You're ready to Go Sync 🎉
Read the documentation on pkg.go.dev
Go Sync consists of two fundamental parts:
As long as your adapters are compatible, you can synchronise anything.
var (
source = mySourceAdapter.New("some-token")
destination = myDestinationAdapter.New(&myDestinationAdapter.Input{})
)
syncSvc := sync.New(source)
err := syncSvc.SyncWith(context.Background(), destination)
if err != nil {
log.Fatal(err)
}
Sync is the logic that powers the automation. It accepts a source adapter, and synchronises it with destination adapters.
Sync is only uni-directional by design. You know where your things are, and where you want them to be. It works by:
- Get a list of things in your source service.
- Cache it, so you're not calling your source service more than you have to.
- Get a list of things in your destination service.
- Add the things that are missing.
- Remove the things that shouldn't be there.
- Repeat from 2 for further adapters.
Adapters 🔌
Adapters provide a common interface to services. Adapters must implement our Adapter interface and functionally perform 3 things:
- Get the things.
- Add some things.
- Remove some things.
These things can be anything, but we recommend email addresses. There's no point trying to sync a Slack User ID with a GitHub user! 🙅
Read about our built-in adapters here, or build your own.