-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclient_options.go
40 lines (33 loc) · 933 Bytes
/
client_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
// Code generated by "go-option -type Client"; DO NOT EDIT.
package webhdfs
// A ClientOption sets options.
type ClientOption interface {
apply(*Client)
}
// EmptyClientOption does not alter the configuration. It can be embedded
// in another structure to build custom options.
//
// This API is EXPERIMENTAL.
type EmptyClientOption struct{}
func (EmptyClientOption) apply(*Client) {}
// ClientOptionFunc wraps a function that modifies Client into an
// implementation of the ClientOption interface.
type ClientOptionFunc func(*Client)
func (f ClientOptionFunc) apply(do *Client) {
f(do)
}
// sample code for option, default for nothing to change
func _ClientOptionWithDefault() ClientOption {
return ClientOptionFunc(func(*Client) {
// nothing to change
})
}
func (o *Client) ApplyOptions(options ...ClientOption) *Client {
for _, opt := range options {
if opt == nil {
continue
}
opt.apply(o)
}
return o
}