-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcodes.go
More file actions
64 lines (52 loc) · 783 Bytes
/
codes.go
File metadata and controls
64 lines (52 loc) · 783 Bytes
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
62
63
64
package goval
import "fmt"
type ruleCode int
func (r ruleCode) Equal(other RuleCoder) bool {
v, ok := other.(ruleCode)
return ok && r == v
}
func (r ruleCode) String() string { return fmt.Sprintf("%d", r) }
type RuleCoder interface {
Equal(other RuleCoder) bool
fmt.Stringer
}
const (
rcPointer ruleCode = (1 + iota) * 1_000
rcString
rcNumber
rcSlice
rcMap
rcTime
)
const (
PtrRequired = rcPointer + iota
)
const (
StringRequired = rcString + iota
StringMin
StringMax
StringMatch
StringIn
StringInFold
)
const (
NumberRequired = rcNumber + iota
NumberMin
NumberMax
NumberIn
)
const (
SliceRequired = rcSlice + iota
SliceMin
SliceMax
)
const (
MapRequired = rcMap + iota
MapMin
MapMax
)
const (
TimeRequired = rcTime + iota
TimeMin
TimeMax
)