Debian Codegraph @

api/v1/lib/scheduler/options.go

raw symbols SCIP
1 package scheduler
2
3 // A CallOpt is a functional option type for Calls.
4 type CallOpt func(*Call)
5
6 // With applies the given CallOpts to the receiving Call, returning it.
7 func (c *Call) With(opts ...CallOpt) *Call {
8 for _, opt := range opts {
9 if opt != nil {
10 opt(c)
11 }
12 }
13 return c
14 }
15
16 // ReconcileOpt is a functional option type for Call_Reconcile
17 type ReconcileOpt func(*Call_Reconcile)
18
19 // With applies the given ReconcileOpt's to the receiving Call_Reconcile, returning it.
20 func (r *Call_Reconcile) With(opts ...ReconcileOpt) *Call_Reconcile {
21 for _, opt := range opts {
22 if opt != nil {
23 opt(r)
24 }
25 }
26 return r
27 }
28
29 type CallOptions []CallOpt
30
31 // Copy returns a cloned copy of CallOptions
32 func (co CallOptions) Copy() CallOptions {
33 if len(co) == 0 {
34 return nil
35 }
36 x := make(CallOptions, len(co))
37 copy(x, co)
38 return x
39 }