@@ -222,7 +222,7 @@ type Form struct {
222222import "github.com/syssam/go-validator"
223223
224224// Using standalone functions
225- if !validator.DateAfter (checkIn, validator.Today()) {
225+ if !validator.IsDateAfter (checkIn, validator.Today()) {
226226 return errors.New("check-in must be after today")
227227}
228228
@@ -251,72 +251,71 @@ years18Ago := validator.T(validator.Today()).SubYears(18)
251251 </pre >
252252</div >
253253<h2 >List of functions:</h2 >
254- <div class =" highlight highlight-source-go " >
255- <pre >
256- IsNumeric(str string) bool
257- IsInt(str string) bool
258- IsFloat(str string) bool
259- IsNull(str string) bool
260- ValidateBetween(i interface{}, params []string) (bool, error)
261- ValidateDigitsBetween(i interface{}, params []string) (bool, error)
262- ValidateDigitsBetweenInt64(value, left, right int64) bool
263- ValidateDigitsBetweenFloat64(value, left, right float64) bool
264- ValidateGt(i interface{}, a interface{}) (bool, error)
265- ValidateGtFloat64(v, param float64) bool
266- ValidateGte(i interface{}, a interface{}) (bool, error)
267- ValidateGteFloat64(v, param float64) bool
268- ValidateLt(i interface{}, a interface{}) (bool, error)
269- ValidateLtFloat64(v, param float64) bool
270- ValidateLte(i interface{}, a interface{}) (bool, error)
271- ValidateLteFloat64(v, param float64) bool
272- ValidateRequired(i interface{}) bool
273- ValidateMin(i interface{}, params []string) (bool, error)
274- ValidateMinFloat64(v, param float64) bool
275- ValidateMax(i interface{}, params []string) (bool, error)
276- ValidateMaxFloat64(v, param float64) bool
277- ValidateSize(i interface{}, params []string) (bool, error)
278- ValidateDistinct(i interface{}) bool
279- ValidateEmail(str string) bool
280- ValidateAlpha(str string) bool
281- ValidateAlphaNum(str string) bool
282- ValidateAlphaDash(str string) bool
283- ValidateAlphaUnicode(str string) bool
284- ValidateAlphaNumUnicode(str string) bool
285- ValidateAlphaDashUnicode(str string) bool
286- ValidateIP(str string) bool
287- ValidateIPv4(str string) bool
288- ValidateIPv6(str string) bool
289- ValidateUUID3(str string) bool
290- ValidateUUID4(str string) bool
291- ValidateUUID5(str string) bool
292- ValidateUUID(str string) bool
293- ValidateURL(str string) bool
294-
295- // Date validation functions
296- Today() time.Time
297- Tomorrow() time.Time
298- Yesterday() time.Time
299- Now() time.Time
300- DateAfter(value, after time.Time) bool
301- DateAfterOrEqual(value, after time.Time) bool
302- DateBefore(value, before time.Time) bool
303- DateBeforeOrEqual(value, before time.Time) bool
304- DateBetween(value, start, end time.Time) bool
305- DateBetweenOrEqual(value, start, end time.Time) bool
306- IsToday(value time.Time) bool
307- IsFuture(value time.Time) bool
308- IsPast(value time.Time) bool
309-
310- // Generic validation functions (Go 1.18+)
311- IsMin[T NumericType](value, min T) bool
312- IsMax[T NumericType](value, max T) bool
313- IsBetween[T NumericType](value, min, max T) bool
314- IsGt[T OrderedType](value, threshold T) bool
315- IsGte[T OrderedType](value, threshold T) bool
316- IsLt[T OrderedType](value, threshold T) bool
317- IsLte[T OrderedType](value, threshold T) bool
318- IsDistinct[T comparable](value []T) bool
319- IsIn[T comparable](value T, allowed []T) bool
320- IsNotIn[T comparable](value T, disallowed []T) bool
321- </pre >
322- </div >
254+ <h4 >String Validation</h4 >
255+ <pre >
256+ IsNumeric(str string) bool
257+ IsInt(str string) bool
258+ IsFloat(str string) bool
259+ IsNull(str string) bool
260+ IsEmail(str string) bool
261+ IsAlpha(str string) bool
262+ IsAlphaNum(str string) bool
263+ IsAlphaDash(str string) bool
264+ IsAlphaUnicode(str string) bool
265+ IsAlphaNumUnicode(str string) bool
266+ IsAlphaDashUnicode(str string) bool
267+ IsIP(str string) bool
268+ IsIPv4(str string) bool
269+ IsIPv6(str string) bool
270+ IsUUID3(str string) bool
271+ IsUUID4(str string) bool
272+ IsUUID5(str string) bool
273+ IsUUID(str string) bool
274+ IsURL(str string) bool
275+ </pre >
276+ <h4 >Value Validation (Reflection-based)</h4 >
277+ <pre >
278+ IsRequired(i interface{}) bool
279+ IsBetween(i interface{}, params []string) (bool, error)
280+ IsDigitsBetween(i interface{}, params []string) (bool, error)
281+ IsMin(i interface{}, params []string) (bool, error)
282+ IsMax(i interface{}, params []string) (bool, error)
283+ IsSize(i interface{}, params []string) (bool, error)
284+ IsDistinct(i interface{}) bool
285+ IsGt(i interface{}, a interface{}) (bool, error)
286+ IsGte(i interface{}, a interface{}) (bool, error)
287+ IsLt(i interface{}, a interface{}) (bool, error)
288+ IsLte(i interface{}, a interface{}) (bool, error)
289+ </pre >
290+ <h4 >Date Validation</h4 >
291+ <pre >
292+ Today() time.Time
293+ Tomorrow() time.Time
294+ Yesterday() time.Time
295+ Now() time.Time
296+ IsDateAfter(value, after time.Time) bool
297+ IsDateAfterOrEqual(value, after time.Time) bool
298+ IsDateBefore(value, before time.Time) bool
299+ IsDateBeforeOrEqual(value, before time.Time) bool
300+ IsDateBetween(value, start, end time.Time) bool
301+ IsDateBetweenOrEqual(value, start, end time.Time) bool
302+ IsToday(value time.Time) bool
303+ IsFuture(value time.Time) bool
304+ IsPast(value time.Time) bool
305+ </pre >
306+ <h4 >Generic Validation (Go 1.18+, Type-safe)</h4 >
307+ <pre >
308+ IsGenericRequired[T comparable](value T) bool
309+ IsGenericRequiredSlice[T any](value []T) bool
310+ IsGenericRequiredMap[K comparable, V any](value map[K]V) bool
311+ IsGenericMin[T NumericType](value, min T) bool
312+ IsGenericMax[T NumericType](value, max T) bool
313+ IsGenericBetween[T NumericType](value, min, max T) bool
314+ IsGenericGt[T OrderedType](value, threshold T) bool
315+ IsGenericGte[T OrderedType](value, threshold T) bool
316+ IsGenericLt[T OrderedType](value, threshold T) bool
317+ IsGenericLte[T OrderedType](value, threshold T) bool
318+ IsGenericDistinct[T comparable](value []T) bool
319+ IsGenericIn[T comparable](value T, allowed []T) bool
320+ IsGenericNotIn[T comparable](value T, disallowed []T) bool
321+ </pre >
0 commit comments