-
Notifications
You must be signed in to change notification settings - Fork 12
/
resolveoneaddr_options.go
50 lines (41 loc) · 1.47 KB
/
resolveoneaddr_options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Code generated by "go-option -type resolveOneAddr"; DO NOT EDIT.
// Install go-option by "go get install github.com/searKing/golang/tools/go-option"
package resolver
// A ResolveOneAddrOption sets options.
type ResolveOneAddrOption interface {
apply(*resolveOneAddr)
}
// EmptyResolveOneAddrOption does not alter the configuration. It can be embedded
// in another structure to build custom options.
//
// This API is EXPERIMENTAL.
type EmptyResolveOneAddrOption struct{}
func (EmptyResolveOneAddrOption) apply(*resolveOneAddr) {}
// ResolveOneAddrOptionFunc wraps a function that modifies resolveOneAddr into an
// implementation of the ResolveOneAddrOption interface.
type ResolveOneAddrOptionFunc func(*resolveOneAddr)
func (f ResolveOneAddrOptionFunc) apply(do *resolveOneAddr) {
f(do)
}
// ApplyOptions call apply() for all options one by one
func (o *resolveOneAddr) ApplyOptions(options ...ResolveOneAddrOption) *resolveOneAddr {
for _, opt := range options {
if opt == nil {
continue
}
opt.apply(o)
}
return o
}
// WithresolveOneAddrPicker appends Picker in resolveOneAddr.
func WithresolveOneAddrPicker(v ...PickOption) ResolveOneAddrOption {
return ResolveOneAddrOptionFunc(func(o *resolveOneAddr) {
o.Picker = append(o.Picker, v...)
})
}
// WithresolveOneAddrPickerReplace sets Picker in resolveOneAddr.
func WithresolveOneAddrPickerReplace(v ...PickOption) ResolveOneAddrOption {
return ResolveOneAddrOptionFunc(func(o *resolveOneAddr) {
o.Picker = v
})
}