Move selector to client/selector
This commit is contained in:
18
client/selector/registry/options.go
Normal file
18
client/selector/registry/options.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package registry
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/micro/go-micro/client/selector"
|
||||
)
|
||||
|
||||
// Set the registry cache ttl
|
||||
func TTL(t time.Duration) selector.Option {
|
||||
return func(o *selector.Options) {
|
||||
if o.Context == nil {
|
||||
o.Context = context.Background()
|
||||
}
|
||||
o.Context = context.WithValue(o.Context, "selector_ttl", t)
|
||||
}
|
||||
}
|
11
client/selector/registry/registry.go
Normal file
11
client/selector/registry/registry.go
Normal file
@@ -0,0 +1,11 @@
|
||||
// Package registry uses the go-micro registry for selection
|
||||
package registry
|
||||
|
||||
import (
|
||||
"github.com/micro/go-micro/client/selector"
|
||||
)
|
||||
|
||||
// NewSelector returns a new registry selector
|
||||
func NewSelector(opts ...selector.Option) selector.Selector {
|
||||
return selector.NewSelector(opts...)
|
||||
}
|
Reference in New Issue
Block a user