-
Notifications
You must be signed in to change notification settings - Fork 12
/
dowithbackoff_options.go
40 lines (33 loc) · 1.06 KB
/
dowithbackoff_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 doWithBackoff"; DO NOT EDIT.
package http
// A DoWithBackoffOption sets options.
type DoWithBackoffOption interface {
apply(*doWithBackoff)
}
// EmptyDoWithBackoffOption does not alter the configuration. It can be embedded
// in another structure to build custom options.
//
// This API is EXPERIMENTAL.
type EmptyDoWithBackoffOption struct{}
func (EmptyDoWithBackoffOption) apply(*doWithBackoff) {}
// DoWithBackoffOptionFunc wraps a function that modifies doWithBackoff into an
// implementation of the DoWithBackoffOption interface.
type DoWithBackoffOptionFunc func(*doWithBackoff)
func (f DoWithBackoffOptionFunc) apply(do *doWithBackoff) {
f(do)
}
// sample code for option, default for nothing to change
func _DoWithBackoffOptionWithDefault() DoWithBackoffOption {
return DoWithBackoffOptionFunc(func(*doWithBackoff) {
// nothing to change
})
}
func (o *doWithBackoff) ApplyOptions(options ...DoWithBackoffOption) *doWithBackoff {
for _, opt := range options {
if opt == nil {
continue
}
opt.apply(o)
}
return o
}