-
Notifications
You must be signed in to change notification settings - Fork 12
/
exponentialbackoff_options.go
47 lines (37 loc) · 1.41 KB
/
exponentialbackoff_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
// Copyright 2020 The searKing Author. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated by "go-option -type ExponentialBackOff"; DO NOT EDIT.
package time
var _default_ExponentialBackOff_value = func() (val ExponentialBackOff) { return }()
// A ExponentialBackOffOption sets options.
type ExponentialBackOffOption interface {
apply(*ExponentialBackOff)
}
// EmptyExponentialBackOffOption does not alter the configuration. It can be embedded
// in another structure to build custom options.
//
// This API is EXPERIMENTAL.
type EmptyExponentialBackOffOption struct{}
func (EmptyExponentialBackOffOption) apply(*ExponentialBackOff) {}
// ExponentialBackOffOptionFunc wraps a function that modifies ExponentialBackOff into an
// implementation of the ExponentialBackOffOption interface.
type ExponentialBackOffOptionFunc func(*ExponentialBackOff)
func (f ExponentialBackOffOptionFunc) apply(do *ExponentialBackOff) {
f(do)
}
// sample code for option, default for nothing to change
func _ExponentialBackOffOptionWithDefault() ExponentialBackOffOption {
return ExponentialBackOffOptionFunc(func(*ExponentialBackOff) {
// nothing to change
})
}
func (o *ExponentialBackOff) ApplyOptions(options ...ExponentialBackOffOption) *ExponentialBackOff {
for _, opt := range options {
if opt == nil {
continue
}
opt.apply(o)
}
return o
}