github.com/searKing/golang/go@v1.2.117/net/http/dowithbackoff_options.go (about) 1 // Code generated by "go-option -type doWithBackoff"; DO NOT EDIT. 2 3 package http 4 5 // A DoWithBackoffOption sets options. 6 type DoWithBackoffOption interface { 7 apply(*doWithBackoff) 8 } 9 10 // EmptyDoWithBackoffOption does not alter the configuration. It can be embedded 11 // in another structure to build custom options. 12 // 13 // This API is EXPERIMENTAL. 14 type EmptyDoWithBackoffOption struct{} 15 16 func (EmptyDoWithBackoffOption) apply(*doWithBackoff) {} 17 18 // DoWithBackoffOptionFunc wraps a function that modifies doWithBackoff into an 19 // implementation of the DoWithBackoffOption interface. 20 type DoWithBackoffOptionFunc func(*doWithBackoff) 21 22 func (f DoWithBackoffOptionFunc) apply(do *doWithBackoff) { 23 f(do) 24 } 25 26 // sample code for option, default for nothing to change 27 func _DoWithBackoffOptionWithDefault() DoWithBackoffOption { 28 return DoWithBackoffOptionFunc(func(*doWithBackoff) { 29 // nothing to change 30 }) 31 } 32 func (o *doWithBackoff) ApplyOptions(options ...DoWithBackoffOption) *doWithBackoff { 33 for _, opt := range options { 34 if opt == nil { 35 continue 36 } 37 opt.apply(o) 38 } 39 return o 40 }