-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomparisons_validations.go
70 lines (62 loc) · 1.41 KB
/
comparisons_validations.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
62
63
64
65
66
67
68
69
70
package god
import "fmt"
func Eq(value interface{}, message ...string) Validation {
return CommonPlaygroundValidation(
"eq",
message,
func(v interface{}) Schema {
err := validate.Var(v, fmt.Sprintf("eq=%v", value))
return Schema{Error: err}
},
)
}
func Ne(value interface{}, message ...string) Validation {
return CommonPlaygroundValidation(
"ne",
message,
func(v interface{}) Schema {
err := validate.Var(v, fmt.Sprintf("ne=%v", value))
return Schema{Error: err}
},
)
}
func Gt(value int, message ...string) Validation {
return CommonPlaygroundValidation(
"gt",
message,
func(v interface{}) Schema {
err := validate.Var(v, fmt.Sprintf("gt=%d", value))
return Schema{Error: err}
},
)
}
func Gte(value int, message ...string) Validation {
return CommonPlaygroundValidation(
"gte",
message,
func(v interface{}) Schema {
err := validate.Var(v, fmt.Sprintf("gte=%d", value))
return Schema{Error: err}
},
)
}
func Lt(value int, message ...string) Validation {
return CommonPlaygroundValidation(
"lt",
message,
func(v interface{}) Schema {
err := validate.Var(v, fmt.Sprintf("lt=%d", value))
return Schema{Error: err}
},
)
}
func Lte(value int, message ...string) Validation {
return CommonPlaygroundValidation(
"lte",
message,
func(v interface{}) Schema {
err := validate.Var(v, fmt.Sprintf("lte=%d", value))
return Schema{Error: err}
},
)
}