Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
06da500ef4 | |||
277f04ba19 | |||
|
470263ff5f | ||
b8232e02be | |||
|
f8c5e10c1d | ||
397e71f815 |
@@ -1,5 +1,5 @@
|
||||
# Micro
|
||||

|
||||

|
||||
|
||||
Micro is a standard library for microservices.
|
||||
|
||||
|
@@ -5,6 +5,7 @@ import (
|
||||
"crypto/tls"
|
||||
"time"
|
||||
|
||||
"go.unistack.org/micro/v3/codec"
|
||||
"go.unistack.org/micro/v3/logger"
|
||||
"go.unistack.org/micro/v3/meter"
|
||||
"go.unistack.org/micro/v3/tracer"
|
||||
@@ -26,6 +27,8 @@ type Options struct {
|
||||
Name string
|
||||
// Addrs specifies register addrs
|
||||
Addrs []string
|
||||
// Codec used to marshal/unmarshal data in register
|
||||
Codec codec.Codec
|
||||
// Timeout specifies timeout
|
||||
Timeout time.Duration
|
||||
}
|
||||
@@ -37,6 +40,7 @@ func NewOptions(opts ...Option) Options {
|
||||
Meter: meter.DefaultMeter,
|
||||
Tracer: tracer.DefaultTracer,
|
||||
Context: context.Background(),
|
||||
Codec: codec.NewCodec(),
|
||||
}
|
||||
for _, o := range opts {
|
||||
o(&options)
|
||||
@@ -134,8 +138,6 @@ type ListOptions struct {
|
||||
Context context.Context
|
||||
// Namespace to scope the request to
|
||||
Namespace string
|
||||
// Name filter services by name
|
||||
Name string
|
||||
}
|
||||
|
||||
// NewListOptions returns list options filled by opts
|
||||
@@ -297,16 +299,15 @@ func ListNamespace(d string) ListOption {
|
||||
}
|
||||
}
|
||||
|
||||
// ListName sets the name for list method to filter needed services
|
||||
func ListName(n string) ListOption {
|
||||
return func(o *ListOptions) {
|
||||
o.Name = n
|
||||
}
|
||||
}
|
||||
|
||||
// Name sets the name
|
||||
func Name(n string) Option {
|
||||
return func(o *Options) {
|
||||
o.Name = n
|
||||
}
|
||||
}
|
||||
|
||||
func Codec(c codec.Codec) Option {
|
||||
return func(o *Options) {
|
||||
o.Codec = c
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user