| 1 |
package scheduler |
| 2 |
|
| 3 |
|
| 4 |
type CallOpt func(*Call) |
| 5 |
|
| 6 |
|
| 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 |
|
| 17 |
type ReconcileOpt func(*Call_Reconcile) |
| 18 |
|
| 19 |
|
| 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 |
|
| 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 |
} |