Change receiver to handler, breaking change, grrr
This commit is contained in:
@@ -12,6 +12,7 @@ type options struct {
|
||||
name string
|
||||
address string
|
||||
id string
|
||||
version string
|
||||
}
|
||||
|
||||
func newOptions(opt ...Option) options {
|
||||
@@ -41,6 +42,10 @@ func newOptions(opt ...Option) options {
|
||||
opts.id = DefaultId
|
||||
}
|
||||
|
||||
if len(opts.version) == 0 {
|
||||
opts.version = DefaultVersion
|
||||
}
|
||||
|
||||
return opts
|
||||
}
|
||||
|
||||
@@ -52,6 +57,10 @@ func (o options) Id() string {
|
||||
return o.name + "-" + o.id
|
||||
}
|
||||
|
||||
func (o options) Version() string {
|
||||
return o.version
|
||||
}
|
||||
|
||||
func (o options) Address() string {
|
||||
return o.address
|
||||
}
|
||||
@@ -59,3 +68,45 @@ func (o options) Address() string {
|
||||
func (o options) Metadata() map[string]string {
|
||||
return o.metadata
|
||||
}
|
||||
|
||||
func Name(n string) Option {
|
||||
return func(o *options) {
|
||||
o.name = n
|
||||
}
|
||||
}
|
||||
|
||||
func Id(id string) Option {
|
||||
return func(o *options) {
|
||||
o.id = id
|
||||
}
|
||||
}
|
||||
|
||||
func Version(v string) Option {
|
||||
return func(o *options) {
|
||||
o.version = v
|
||||
}
|
||||
}
|
||||
|
||||
func Address(a string) Option {
|
||||
return func(o *options) {
|
||||
o.address = a
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
func Metadata(md map[string]string) Option {
|
||||
return func(o *options) {
|
||||
o.metadata = md
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user