mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-24 10:07:04 +02:00
more comments
This commit is contained in:
parent
bb360d5f2c
commit
24b8cd3d97
@ -83,60 +83,70 @@ func (o options) Metadata() map[string]string {
|
||||
return o.metadata
|
||||
}
|
||||
|
||||
// Server name
|
||||
func Name(n string) Option {
|
||||
return func(o *options) {
|
||||
o.name = n
|
||||
}
|
||||
}
|
||||
|
||||
// Unique server id
|
||||
func Id(id string) Option {
|
||||
return func(o *options) {
|
||||
o.id = id
|
||||
}
|
||||
}
|
||||
|
||||
// Version of the service
|
||||
func Version(v string) Option {
|
||||
return func(o *options) {
|
||||
o.version = v
|
||||
}
|
||||
}
|
||||
|
||||
// Address to bind to - host:port
|
||||
func Address(a string) Option {
|
||||
return func(o *options) {
|
||||
o.address = a
|
||||
}
|
||||
}
|
||||
|
||||
// The address to advertise for discovery - host:port
|
||||
func Advertise(a string) Option {
|
||||
return func(o *options) {
|
||||
o.advertise = a
|
||||
}
|
||||
}
|
||||
|
||||
// Broker to use for pub/sub
|
||||
func Broker(b broker.Broker) Option {
|
||||
return func(o *options) {
|
||||
o.broker = b
|
||||
}
|
||||
}
|
||||
|
||||
// Codec to use to encode/decode requests for a given content type
|
||||
func Codec(contentType string, cf CodecFunc) Option {
|
||||
return func(o *options) {
|
||||
o.codecs[contentType] = cf
|
||||
}
|
||||
}
|
||||
|
||||
// Registry used for discovery
|
||||
func Registry(r registry.Registry) Option {
|
||||
return func(o *options) {
|
||||
o.registry = r
|
||||
}
|
||||
}
|
||||
|
||||
// Transport mechanism for communication e.g http, rabbitmq, etc
|
||||
func Transport(t transport.Transport) Option {
|
||||
return func(o *options) {
|
||||
o.transport = t
|
||||
}
|
||||
}
|
||||
|
||||
// Metadata associated with the server
|
||||
func Metadata(md map[string]string) Option {
|
||||
return func(o *options) {
|
||||
o.metadata = md
|
||||
|
Loading…
Reference in New Issue
Block a user