-
Notifications
You must be signed in to change notification settings - Fork 12
/
handlerinterceptorchain_options.go
43 lines (34 loc) · 1.37 KB
/
handlerinterceptorchain_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
// Code generated by "go-option -type HandlerInterceptorChain"; DO NOT EDIT.
package http
var _default_HandlerInterceptorChain_value = func() (val HandlerInterceptorChain) { return }()
// A HandlerInterceptorChainOption sets options.
type HandlerInterceptorChainOption interface {
apply(*HandlerInterceptorChain)
}
// EmptyHandlerInterceptorChainOption does not alter the configuration. It can be embedded
// in another structure to build custom options.
//
// This API is EXPERIMENTAL.
type EmptyHandlerInterceptorChainOption struct{}
func (EmptyHandlerInterceptorChainOption) apply(*HandlerInterceptorChain) {}
// HandlerInterceptorChainOptionFunc wraps a function that modifies HandlerInterceptorChain into an
// implementation of the HandlerInterceptorChainOption interface.
type HandlerInterceptorChainOptionFunc func(*HandlerInterceptorChain)
func (f HandlerInterceptorChainOptionFunc) apply(do *HandlerInterceptorChain) {
f(do)
}
// sample code for option, default for nothing to change
func _HandlerInterceptorChainOptionWithDefault() HandlerInterceptorChainOption {
return HandlerInterceptorChainOptionFunc(func(*HandlerInterceptorChain) {
// nothing to change
})
}
func (o *HandlerInterceptorChain) ApplyOptions(options ...HandlerInterceptorChainOption) *HandlerInterceptorChain {
for _, opt := range options {
if opt == nil {
continue
}
opt.apply(o)
}
return o
}