You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc.go
+22-14Lines changed: 22 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
Package validator implements value validations for structs and individual fields based on tags. It can also handle Cross Field validation and even Cross Field Cross Struct validation for nested structs.
2
+
Package validator implements value validations for structs and individual fields based on tags. It can also handle Cross Field and Cross Struct validation for nested structs.
3
3
4
4
Validate
5
5
@@ -250,57 +250,65 @@ Here is a list of the current built in validators:
250
250
Validating by field validate.FieldWithValue(start, end, "ltefield")
251
251
252
252
alpha
253
-
This validates that a strings value contains alpha characters only
253
+
This validates that a string value contains alpha characters only
254
254
(Usage: alpha)
255
255
256
256
alphanum
257
-
This validates that a strings value contains alphanumeric characters only
257
+
This validates that a string value contains alphanumeric characters only
258
258
(Usage: alphanum)
259
259
260
260
numeric
261
-
This validates that a strings value contains a basic numeric value.
261
+
This validates that a string value contains a basic numeric value.
262
262
basic excludes exponents etc...
263
263
(Usage: numeric)
264
264
265
265
hexadecimal
266
-
This validates that a strings value contains a valid hexadecimal.
266
+
This validates that a string value contains a valid hexadecimal.
267
267
(Usage: hexadecimal)
268
268
269
269
hexcolor
270
-
This validates that a strings value contains a valid hex color including
270
+
This validates that a string value contains a valid hex color including
271
271
hashtag (#)
272
272
(Usage: hexcolor)
273
273
274
274
rgb
275
-
This validates that a strings value contains a valid rgb color
275
+
This validates that a string value contains a valid rgb color
276
276
(Usage: rgb)
277
277
278
278
rgba
279
-
This validates that a strings value contains a valid rgba color
279
+
This validates that a string value contains a valid rgba color
280
280
(Usage: rgba)
281
281
282
282
hsl
283
-
This validates that a strings value contains a valid hsl color
283
+
This validates that a string value contains a valid hsl color
284
284
(Usage: hsl)
285
285
286
286
hsla
287
-
This validates that a strings value contains a valid hsla color
287
+
This validates that a string value contains a valid hsla color
288
288
(Usage: hsla)
289
289
290
290
email
291
-
This validates that a strings value contains a valid email
291
+
This validates that a string value contains a valid email
292
292
This may not conform to all possibilities of any rfc standard, but neither
293
293
does any email provider accept all posibilities...
294
294
(Usage: email)
295
+
295
296
url
296
-
This validates that a strings value contains a valid url
297
+
This validates that a string value contains a valid url
297
298
This will accept any url the golang request uri accepts but must contain
298
299
a schema for example http:// or rtmp://
299
300
(Usage: url)
301
+
300
302
uri
301
-
This validates that a strings value contains a valid uri
303
+
This validates that a string value contains a valid uri
302
304
This will accept any uri the golang request uri accepts (Usage: uri)
303
305
306
+
base64
307
+
This validates that a string value contains a valid base64 value.
308
+
Although an empty string is valid base64 this will report an empty string
309
+
as an error, if you wish to accept an empty string as valid you can use
310
+
this with the omitempty tag. (Usage: base64)
311
+
304
312
Validator notes:
305
313
306
314
regex
@@ -314,7 +322,7 @@ Validator notes:
314
322
used within the validator function and even be precompiled for better efficiency
315
323
within regexes.go.
316
324
317
-
And the best reason, you can sumit a pull request and we can keep on adding to the
325
+
And the best reason, you can submit a pull request and we can keep on adding to the
0 commit comments