cleanup client/selector/lookup (#1937)

* cleanup client/selector/lookup

* add mdns router, remove registry from client

* fix roundtripper

* remove comment

* fix compile issue

* fix mucp test

* fix api router
This commit is contained in:
Asim Aslam
2020-08-17 22:44:45 +01:00
committed by GitHub
parent 7135787b78
commit 50ec6c748f
17 changed files with 398 additions and 418 deletions

View File

@@ -1,31 +1,17 @@
package selector
import "github.com/micro/go-micro/v3/router"
// Options used to configure a selector
type Options struct{}
// Option updates the options
type Option func(*Options)
// Filter the routes
type Filter func([]router.Route) []router.Route
// SelectOptions used to configure selection
type SelectOptions struct {
Filters []Filter
}
type SelectOptions struct{}
// SelectOption updates the select options
type SelectOption func(*SelectOptions)
// WithFilter adds a filter to the options
func WithFilter(f Filter) SelectOption {
return func(o *SelectOptions) {
o.Filters = append(o.Filters, f)
}
}
// NewSelectOptions parses select options
func NewSelectOptions(opts ...SelectOption) SelectOptions {
var options SelectOptions
@@ -33,9 +19,5 @@ func NewSelectOptions(opts ...SelectOption) SelectOptions {
o(&options)
}
if options.Filters == nil {
options.Filters = make([]Filter, 0)
}
return options
}