-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoption.go
36 lines (31 loc) · 950 Bytes
/
option.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
package traveller
// Represents an optional setting for Traveller.
type TravellerOption func(*Traveller)
// Prevents flattening of embedded types into the matcher.
// Embedded structs will be only be treated as normal fields.
func WithNoFlatEmbeds(noFlatEmbeds bool) TravellerOption {
return func(t *Traveller) {
t.noFlatEmbeds = noFlatEmbeds
}
}
// Prevent traversal into structs.
// Does not prevent returns of struct values.
func WithIgnoreStruct(ignoreStruct bool) TravellerOption {
return func(t *Traveller) {
t.ignoreStruct = ignoreStruct
}
}
// Prevent traversal into maps.
// Does not prevent returns of map values.
func WithIgnoreMap(ignoreMap bool) TravellerOption {
return func(t *Traveller) {
t.ignoreMap = ignoreMap
}
}
// Prevent traversal into arrays.
// Does not prevent returns of array values.
func WithIgnoreArray(ignoreArray bool) TravellerOption {
return func(t *Traveller) {
t.ignoreArray = ignoreArray
}
}