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
|
package scheduler
// A CallOpt is a functional option type for Calls.
type CallOpt func(*Call)
// With applies the given CallOpts to the receiving Call, returning it.
func (c *Call) With(opts ...CallOpt) *Call {
for _, opt := range opts {
if opt != nil {
opt(c)
}
}
return c
}
// ReconcileOpt is a functional option type for Call_Reconcile
type ReconcileOpt func(*Call_Reconcile)
// With applies the given ReconcileOpt's to the receiving Call_Reconcile, returning it.
func (r *Call_Reconcile) With(opts ...ReconcileOpt) *Call_Reconcile {
for _, opt := range opts {
if opt != nil {
opt(r)
}
}
return r
}
type CallOptions []CallOpt
// Copy returns a cloned copy of CallOptions
func (co CallOptions) Copy() CallOptions {
if len(co) == 0 {
return nil
}
x := make(CallOptions, len(co))
copy(x, co)
return x
}
|