Skip to content

Instantly share code, notes, and snippets.

@emretanriverdi
Created January 17, 2021 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emretanriverdi/ddcd99f109fa2ad77d7c18e3d536b82a to your computer and use it in GitHub Desktop.
Save emretanriverdi/ddcd99f109fa2ad77d7c18e3d536b82a to your computer and use it in GitHub Desktop.
sequential-implemented.go
func upsert(user User) {
upsertToPostgres(user)
upsertToCouchbase(user, "key")
}
func upsertToPostgres(user User) {
fmt.Println("# upserting userId to two tables in Postgres")
time.Sleep(20 * time.Millisecond)
fmt.Println("# upserting userName to one table in Postgres")
time.Sleep(10 * time.Millisecond)
}
func upsertToCouchbase(user User, key string) {
fmt.Println("# upserting to Couchbase")
time.Sleep(5 * time.Millisecond)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment