1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-11-24 08:02:32 +02:00

feat(sync): Add additional context option to sync (#2544)

This commit is contained in:
David Bereza 2022-08-10 22:09:25 -07:00 committed by GitHub
parent 51250bf248
commit f40cfdda82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package sync
import (
"context"
"crypto/tls"
"time"
)
@ -39,3 +40,10 @@ func WithTLS(t *tls.Config) Option {
o.TLSConfig = t
}
}
// WithContext sets the syncs context, for any extra configuration
func WithContext(c context.Context) Option {
return func(o *Options) {
o.Context = c
}
}

View File

@ -2,6 +2,7 @@
package sync
import (
"context"
"crypto/tls"
"errors"
"time"
@ -39,6 +40,7 @@ type Options struct {
Nodes []string
Prefix string
TLSConfig *tls.Config
Context context.Context
}
type Option func(o *Options)