@@ -355,42 +355,87 @@ equal to the parameter given. For strings, it checks that
355355the string length is exactly that number of characters. For slices,
356356arrays, and maps, validates the number of items.
357357
358+ Example #1
359+
358360 Usage: len=10
359361
362+ Example #2 (time.Duration)
363+
364+ For time.Duration, len will ensure that the value is equal to the duration given
365+ in the parameter.
366+
367+ Usage: len=1h30m
368+
360369Maximum
361370
362371For numbers, max will ensure that the value is
363372less than or equal to the parameter given. For strings, it checks
364373that the string length is at most that number of characters. For
365374slices, arrays, and maps, validates the number of items.
366375
376+ Example #1
377+
367378 Usage: max=10
368379
380+ Example #2 (time.Duration)
381+
382+ For time.Duration, max will ensure that the value is less than or equal to the
383+ duration given in the parameter.
384+
385+ Usage: max=1h30m
386+
369387Minimum
370388
371389For numbers, min will ensure that the value is
372390greater or equal to the parameter given. For strings, it checks that
373391the string length is at least that number of characters. For slices,
374392arrays, and maps, validates the number of items.
375393
394+ Example #1
395+
376396 Usage: min=10
377397
398+ Example #2 (time.Duration)
399+
400+ For time.Duration, min will ensure that the value is greater than or equal to
401+ the duration given in the parameter.
402+
403+ Usage: min=1h30m
404+
378405Equals
379406
380407For strings & numbers, eq will ensure that the value is
381408equal to the parameter given. For slices, arrays, and maps,
382409validates the number of items.
383410
411+ Example #1
412+
384413 Usage: eq=10
385414
415+ Example #2 (time.Duration)
416+
417+ For time.Duration, eq will ensure that the value is equal to the duration given
418+ in the parameter.
419+
420+ Usage: eq=1h30m
421+
386422Not Equal
387423
388424For strings & numbers, ne will ensure that the value is not
389425equal to the parameter given. For slices, arrays, and maps,
390426validates the number of items.
391427
428+ Example #1
429+
392430 Usage: ne=10
393431
432+ Example #2 (time.Duration)
433+
434+ For time.Duration, ne will ensure that the value is not equal to the duration
435+ given in the parameter.
436+
437+ Usage: ne=1h30m
438+
394439One Of
395440
396441For strings, ints, and uints, oneof will ensure that the value
@@ -420,11 +465,17 @@ For time.Time ensures the time value is greater than time.Now.UTC().
420465
421466 Usage: gt
422467
468+ Example #3 (time.Duration)
469+
470+ For time.Duration, gt will ensure that the value is greater than the duration
471+ given in the parameter.
472+
473+ Usage: gt=1h30m
474+
423475Greater Than or Equal
424476
425477Same as 'min' above. Kept both to make terminology with 'len' easier.
426478
427-
428479Example #1
429480
430481 Usage: gte=10
@@ -435,6 +486,13 @@ For time.Time ensures the time value is greater than or equal to time.Now.UTC().
435486
436487 Usage: gte
437488
489+ Example #3 (time.Duration)
490+
491+ For time.Duration, gte will ensure that the value is greater than or equal to
492+ the duration given in the parameter.
493+
494+ Usage: gte=1h30m
495+
438496Less Than
439497
440498For numbers, this will ensure that the value is less than the parameter given.
@@ -446,10 +504,18 @@ Example #1
446504 Usage: lt=10
447505
448506Example #2 (time.Time)
507+
449508For time.Time ensures the time value is less than time.Now.UTC().
450509
451510 Usage: lt
452511
512+ Example #3 (time.Duration)
513+
514+ For time.Duration, lt will ensure that the value is less than the duration given
515+ in the parameter.
516+
517+ Usage: lt=1h30m
518+
453519Less Than or Equal
454520
455521Same as 'max' above. Kept both to make terminology with 'len' easier.
@@ -464,6 +530,13 @@ For time.Time ensures the time value is less than or equal to time.Now.UTC().
464530
465531 Usage: lte
466532
533+ Example #3 (time.Duration)
534+
535+ For time.Duration, lte will ensure that the value is less than or equal to the
536+ duration given in the parameter.
537+
538+ Usage: lte=1h30m
539+
467540Field Equals Another Field
468541
469542This will validate the field value against another fields value either within
@@ -510,9 +583,9 @@ relative to the top level struct.
510583
511584Field Greater Than Another Field
512585
513- Only valid for Numbers and time.Time types, this will validate the field value
514- against another fields value either within a struct or passed in field.
515- usage examples are for validation of a Start and End date:
586+ Only valid for Numbers, time.Duration and time.Time types, this will validate
587+ the field value against another fields value either within a struct or passed in
588+ field. usage examples are for validation of a Start and End date:
516589
517590Example #1:
518591
@@ -524,7 +597,6 @@ Example #2:
524597 // Validating by field:
525598 validate.VarWithValue(start, end, "gtfield")
526599
527-
528600Field Greater Than Another Relative Field
529601
530602This does the same as gtfield except that it validates the field provided
@@ -534,9 +606,9 @@ relative to the top level struct.
534606
535607Field Greater Than or Equal To Another Field
536608
537- Only valid for Numbers and time.Time types, this will validate the field value
538- against another fields value either within a struct or passed in field.
539- usage examples are for validation of a Start and End date:
609+ Only valid for Numbers, time.Duration and time.Time types, this will validate
610+ the field value against another fields value either within a struct or passed in
611+ field. usage examples are for validation of a Start and End date:
540612
541613Example #1:
542614
@@ -557,9 +629,9 @@ to the top level struct.
557629
558630Less Than Another Field
559631
560- Only valid for Numbers and time.Time types, this will validate the field value
561- against another fields value either within a struct or passed in field.
562- usage examples are for validation of a Start and End date:
632+ Only valid for Numbers, time.Duration and time.Time types, this will validate
633+ the field value against another fields value either within a struct or passed in
634+ field. usage examples are for validation of a Start and End date:
563635
564636Example #1:
565637
@@ -580,9 +652,9 @@ to the top level struct.
580652
581653Less Than or Equal To Another Field
582654
583- Only valid for Numbers and time.Time types, this will validate the field value
584- against another fields value either within a struct or passed in field.
585- usage examples are for validation of a Start and End date:
655+ Only valid for Numbers, time.Duration and time.Time types, this will validate
656+ the field value against another fields value either within a struct or passed in
657+ field. usage examples are for validation of a Start and End date:
586658
587659Example #1:
588660
0 commit comments