Move selector to client/selector

This commit is contained in:
Asim Aslam
2019-06-21 15:13:54 +01:00
parent c350e19552
commit ca5acba0c6
28 changed files with 21 additions and 21 deletions

View 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)
}
}

View 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...)
}