gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/sync/options.go (about) 1 package sync 2 3 import ( 4 "gitee.com/liuxuezhan/go-micro-v1.18.0/store" 5 "gitee.com/liuxuezhan/go-micro-v1.18.0/sync/leader" 6 "gitee.com/liuxuezhan/go-micro-v1.18.0/sync/lock" 7 "gitee.com/liuxuezhan/go-micro-v1.18.0/sync/time" 8 ) 9 10 // WithLeader sets the leader election implementation opton 11 func WithLeader(l leader.Leader) Option { 12 return func(o *Options) { 13 o.Leader = l 14 } 15 } 16 17 // WithLock sets the locking implementation option 18 func WithLock(l lock.Lock) Option { 19 return func(o *Options) { 20 o.Lock = l 21 } 22 } 23 24 // WithStore sets the store implementation option 25 func WithStore(s store.Store) Option { 26 return func(o *Options) { 27 o.Store = s 28 } 29 } 30 31 // WithTime sets the time implementation option 32 func WithTime(t time.Time) Option { 33 return func(o *Options) { 34 o.Time = t 35 } 36 }