-
Notifications
You must be signed in to change notification settings - Fork 1
/
interfaces.go
40 lines (32 loc) · 947 Bytes
/
interfaces.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
package refutil
import "reflect"
// Equalizer is way how to check if object
// can compare it self to another object. Used
// only with `Equal` method
type Equalizer interface {
Equal(v interface{}) bool
}
// Kinder as interface for reflect.Value or reflect.Type Kind() method
type Kinder interface {
Kind() reflect.Kind
}
// Comparator is used as abstraction for method
// like IsEqual which compare two values
type Comparator func(interface{}, interface{}) bool
// Zeroer ...
type Zeroer interface {
IsZero() bool
}
// Indexer provides unified searching for key, value
// in map, struct or slice.
type Indexer interface {
At(i int) (Value, Value)
Keys() []Value
}
// IteratorFunc function iterates over Indexer
// providing key and value
type IteratorFunc func(*Iterator)
// SearchFunc function iterates over Indexer
// providing key and value and return result if
// result of function is true
type SearchFunc func(*KeyValue) bool