-
Notifications
You must be signed in to change notification settings - Fork 1
/
options.go
45 lines (37 loc) · 1.11 KB
/
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
// SPDX-FileCopyrightText: 2019 Elasticsearch B.V.
// SPDX-FileCopyrightText: 2019-2023 Thibault NORMAND <me@zenithar.org>
//
// SPDX-License-Identifier: Apache-2.0 AND MIT
package patch
type options struct {
stopAtRuleID string
stopAtRuleIndex int
ignoreRuleIDs []string
ignoreRuleIndexes []int
}
type OptionFunc func(o *options)
// -----------------------------------------------------------------------------
// WithStopAtRuleID sets the id of the rule to stop evaluation at.
func WithStopAtRuleID(value string) OptionFunc {
return func(o *options) {
o.stopAtRuleID = value
}
}
// WithStopAtRuleIndex sets the index of the rule to stop evaluation at.
func WithStopAtRuleIndex(value int) OptionFunc {
return func(o *options) {
o.stopAtRuleIndex = value
}
}
// WithIgnoreRuleIDs sets the rule identifiers to ignore.
func WithIgnoreRuleIDs(values ...string) OptionFunc {
return func(o *options) {
o.ignoreRuleIDs = values
}
}
// WithIgnoreRuleIndexes sets the rule indexes to ignore.
func WithIgnoreRuleIndexes(values ...int) OptionFunc {
return func(o *options) {
o.ignoreRuleIndexes = values
}
}