mirror of
https://github.com/go-micro/go-micro.git
synced 2025-01-05 10:20:53 +02:00
1db36357d5
* feat(logger): add logger option to all components * fix: refactor api/rpc.go * fix: refactor api/stream.go * fix: api/options.go comment * fix(logger): do not use logger.Helper internally * fix(logger): fix comments * fix(logger): use level.Enabled method * fix: rename mlogger to log * fix: run go fmt * fix: log level * fix: factories Co-authored-by: Mohamed MHAMDI <mmhamdi@hubside.com> Co-authored-by: Davincible <david.brouwer.99@gmail.com>
59 lines
980 B
Go
59 lines
980 B
Go
package sync
|
|
|
|
import (
|
|
"context"
|
|
"crypto/tls"
|
|
"time"
|
|
|
|
"go-micro.dev/v4/logger"
|
|
)
|
|
|
|
// Nodes sets the addresses to use
|
|
func Nodes(a ...string) Option {
|
|
return func(o *Options) {
|
|
o.Nodes = a
|
|
}
|
|
}
|
|
|
|
// Prefix sets a prefix to any lock ids used
|
|
func Prefix(p string) Option {
|
|
return func(o *Options) {
|
|
o.Prefix = p
|
|
}
|
|
}
|
|
|
|
// LockTTL sets the lock ttl
|
|
func LockTTL(t time.Duration) LockOption {
|
|
return func(o *LockOptions) {
|
|
o.TTL = t
|
|
}
|
|
}
|
|
|
|
// LockWait sets the wait time
|
|
func LockWait(t time.Duration) LockOption {
|
|
return func(o *LockOptions) {
|
|
o.Wait = t
|
|
}
|
|
}
|
|
|
|
// WithTLS sets the TLS config
|
|
func WithTLS(t *tls.Config) Option {
|
|
return func(o *Options) {
|
|
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
|
|
}
|
|
}
|
|
|
|
// WithLogger sets the underline logger
|
|
func WithLogger(l logger.Logger) Option {
|
|
return func(o *Options) {
|
|
o.Logger = l
|
|
}
|
|
}
|