-
Notifications
You must be signed in to change notification settings - Fork 1
/
contains.go
61 lines (52 loc) · 2.3 KB
/
contains.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package refutil
// ContainsKey will search for specific key in list
// and return bool if found. It panics if list is not searchable
func (v Value) ContainsKey(compare Comparator, element interface{}) bool {
keyval := v.SearchKey(compare, element)
return keyval != nil
}
// ContainsKey will search for specific key in list
// and return bool if found. It panics if list is not searchable
func (v Data) ContainsKey(compare Comparator, element interface{}) bool {
return v.v.ContainsKey(compare, element)
}
// ContainsKey will search for specific key in list
// and return bool if found. It panics if list is not searchable
func ContainsKey(source interface{}, element interface{}) bool {
return NewData(source).ContainsKey(Equal, element)
}
// ContainsSameKey will search for specific key in list
// and return bool if found. It panics if list is not searchable.
// Unlike ContainsKey compared keys needs to be deep equal
func ContainsSameKey(source interface{}, element interface{}) bool {
return NewData(source).ContainsKey(DeepEqual, element)
}
// ContainsValue will search for specific value in list
// and return bool if found. It panics if list is not searchable
func (v Value) ContainsValue(compare Comparator, element interface{}) bool {
keyval := v.SearchValue(compare, element)
return keyval != nil
}
// ContainsValue will search for specific value in list
// and return bool if found.
// It panics if list is not searchable
func (v Data) ContainsValue(compare Comparator, element interface{}) bool {
return v.v.ContainsValue(compare, element)
}
// ContainsValue will search for specific value in list
// and return bool if found.
// it panics if list is not searchable
func ContainsValue(source interface{}, element interface{}) bool {
return NewData(source).ContainsValue(Equal, element)
}
// ContainsSameValue will search for specific value in list
// and return bool if found. It panics if list is not searchable.
// Unlike ContainsValue compared keys needs to be deep equal
func ContainsSameValue(source interface{}, element interface{}) bool {
return NewData(source).ContainsValue(DeepEqual, element)
}
// Contains will search for specific value in list
// and return bool if found. It panics if list is not searchable
func Contains(source interface{}, element interface{}) bool {
return ContainsValue(source, element)
}