This repository was archived by the owner on Dec 7, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtag.go
More file actions
149 lines (143 loc) · 7.4 KB
/
tag.go
File metadata and controls
149 lines (143 loc) · 7.4 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
package csv
// tag is struct tag name.
type tag string
const (
// validateTag is the struct tag name for validation rules.
validateTag tag = "validate"
)
// tagValue is the struct tag value.
type tagValue string
const (
// booleanTagValue is the struct tag value for boolean rule.
booleanTagValue tagValue = "boolean"
// alphaTagValue is the struct tag name for alpha only fields.
alphaTagValue tagValue = "alpha"
// alphaSpaceTagValue is the struct tag name for alpha with spaces fields.
alphaSpaceTagValue tagValue = "alphaspace"
// alphaUnicodeTagValue is the struct tag name for unicode alpha only fields.
alphaUnicodeTagValue tagValue = "alphaunicode"
// numericTagValue is the struct tag name for numeric fields.
numericTagValue tagValue = "numeric"
// alphanumericTagValue is the struct tag name for alphanumeric fields.
alphanumericTagValue tagValue = "alphanumeric"
// alphanumericUnicodeTagValue is the struct tag name for alphanumeric unicode fields.
alphanumericUnicodeTagValue tagValue = "alphanumunicode"
// requiredTagValue is the struct tag name for required fields.
requiredTagValue tagValue = "required"
// equalTagValue is the struct tag name for equal fields.
equalTagValue tagValue = "eq"
// notEqualTagValue is the struct tag name for not equal fields.
notEqualTagValue tagValue = "ne"
// greaterThanTagValue is the struct tag name for greater than fields.
greaterThanTagValue tagValue = "gt"
// greaterThanEqualTagValue is the struct tag name for greater than or equal fields.
greaterThanEqualTagValue tagValue = "gte"
// lessThanTagValue is the struct tag name for less than fields.
lessThanTagValue tagValue = "lt"
// lessThanEqualTagValue is the struct tag name for less than or equal fields.
lessThanEqualTagValue tagValue = "lte"
// minTagValue is the struct tag name for minimum fields.
minTagValue tagValue = "min"
// maxTagValue is the struct tag name for maximum fields.
maxTagValue tagValue = "max"
// lengthTagValue is the struct tag name for length fields.
lengthTagValue tagValue = "len"
// equalIgnoreCaseTagValue is the struct tag name for case-insensitive equal fields.
equalIgnoreCaseTagValue tagValue = "eq_ignore_case"
// notEqualFieldTagValue is the struct tag name for not equal to another field (same struct, flat).
notEqualFieldTagValue tagValue = "nefield"
// greaterThanEqualFieldTagValue is the struct tag name for greater than or equal to another field.
greaterThanEqualFieldTagValue tagValue = "gtefield"
// oneOfTagValue is the struct tag name for one of fields.
oneOfTagValue tagValue = "oneof"
// lowercaseTagValue is the struct tag name for lowercase fields.
lowercaseTagValue tagValue = "lowercase"
// uppercaseTagValue is the struct tag name for uppercase fields.
uppercaseTagValue tagValue = "uppercase"
// asciiTagValue is the struct tag name for ascii fields.
asciiTagValue tagValue = "ascii"
// notEqualIgnoreCaseTagValue is the struct tag name for case-insensitive not equal fields.
notEqualIgnoreCaseTagValue tagValue = "ne_ignore_case"
// numberTagValue is the struct tag name for number fields.
numberTagValue tagValue = "number"
// containsRuneTagValue is the struct tag name for contains rune fields.
containsRuneTagValue tagValue = "containsrune"
// fieldContainsTagValue is the struct tag name for fieldcontains (string contains other field) rule.
fieldContainsTagValue tagValue = "fieldcontains"
// fieldExcludesTagValue is the struct tag name for fieldexcludes (string does not contain other field) rule.
fieldExcludesTagValue tagValue = "fieldexcludes"
// uriTagValue is the struct tag name for uri fields.
uriTagValue tagValue = "uri"
// urlTagValue is the struct tag name for url fields.
urlTagValue tagValue = "url"
// httpURLTagValue is the struct tag name for http or https url fields.
httpURLTagValue tagValue = "http_url"
// httpsURLTagValue is the struct tag name for https-only url fields.
httpsURLTagValue tagValue = "https_url"
// urlEncodedTagValue is the struct tag name for url encoded fields.
urlEncodedTagValue tagValue = "url_encoded"
// dataURITagValue is the struct tag name for data URI fields.
dataURITagValue tagValue = "datauri"
// fqdnTagValue is the struct tag name for fully qualified domain name fields.
fqdnTagValue tagValue = "fqdn"
// hostnameTagValue is the struct tag name for hostname (RFC 952) fields.
hostnameTagValue tagValue = "hostname"
// hostnameRFC1123TagValue is the struct tag name for hostname (RFC 1123) fields.
hostnameRFC1123TagValue tagValue = "hostname_rfc1123"
// hostnamePortTagValue is the struct tag name for hostname with port fields.
hostnamePortTagValue tagValue = "hostname_port"
// ipAddrTagValue is the struct tag name for ip_addr fields (IPv4 or IPv6).
ipAddrTagValue tagValue = "ip_addr"
// ip4AddrTagValue is the struct tag name for ip4_addr fields (IPv4 only).
ip4AddrTagValue tagValue = "ip4_addr"
// ip6AddrTagValue is the struct tag name for ip6_addr fields (IPv6 only).
ip6AddrTagValue tagValue = "ip6_addr"
// uuidTagValue is the struct tag name for uuid fields.
uuidTagValue tagValue = "uuid"
// emailTagValue is the struct tag name for email fields.
emailTagValue tagValue = "email"
// startsWithTagValue is the struct tag name for startswith fields.
startsWithTagValue tagValue = "startswith"
// startsNotWithTagValue is the struct tag name for startsnotwith fields.
startsNotWithTagValue tagValue = "startsnotwith"
// endsWithTagValue is the struct tag name for endswith fields.
endsWithTagValue tagValue = "endswith"
// endsNotWithTagValue is the struct tag name for endsnotwith fields.
endsNotWithTagValue tagValue = "endsnotwith"
// excludesTagValue is the struct tag name for excludes fields.
excludesTagValue tagValue = "excludes"
// excludesAllTagValue is the struct tag name for excludesall fields.
excludesAllTagValue tagValue = "excludesall"
// excludesRuneTagValue is the struct tag name for excludesrune fields.
excludesRuneTagValue tagValue = "excludesrune"
// multibyteTagValue is the struct tag name for multibyte fields.
multibyteTagValue tagValue = "multibyte"
// printASCIITagValue is the struct tag name for printable ascii fields.
printASCIITagValue tagValue = "printascii"
// cidrTagValue is the struct tag name for cidr fields.
cidrTagValue tagValue = "cidr"
// cidrv4TagValue is the struct tag name for cidrv4 fields.
cidrv4TagValue tagValue = "cidrv4"
// cidrv6TagValue is the struct tag name for cidrv6 fields.
cidrv6TagValue tagValue = "cidrv6"
// equalFieldTagValue is the struct tag name for equal to another field (same struct, flat).
equalFieldTagValue tagValue = "eqfield"
// greaterThanFieldTagValue is the struct tag name for greater than another field (same struct, flat).
greaterThanFieldTagValue tagValue = "gtfield"
// lessThanEqualFieldTagValue is the struct tag name for less than or equal to another field (same struct, flat).
lessThanEqualFieldTagValue tagValue = "ltefield"
// lessThanFieldTagValue is the struct tag name for less than another field (same struct, flat).
lessThanFieldTagValue tagValue = "ltfield"
// containsTagValue is the struct tag name for contains fields.
containsTagValue tagValue = "contains"
// containsAnyTagValue is the struct tag name for contains any fields.
containsAnyTagValue tagValue = "containsany"
)
// String returns the string representation of the tag.
func (t tag) String() string {
return string(t)
}
// String returns the string representation of the tag value.
func (t tagValue) String() string {
return string(t)
}