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

add ability to set the options

This commit is contained in:
Asim 2015-12-21 01:13:29 +00:00
parent 45dcffcaaf
commit 4f1a1c6783

View File

@ -44,3 +44,33 @@ func newOptions(opts ...Option) Options {
return opt
}
func Broker(b broker.Broker) Option {
return func(o *Options) {
o.Broker = b
}
}
func Client(c client.Client) Option {
return func(o *Options) {
o.Client = c
}
}
func Server(s server.Server) Option {
return func(o *Options) {
o.Server = s
}
}
func Registry(r registry.Registry) Option {
return func(o *Options) {
o.Registry = r
}
}
func Transport(t transport.Transport) Option {
return func(o *Options) {
o.Transport = t
}
}