Documentation
¶
Index ¶
- func Base64(value any) bool
- func Base64URL(value any) bool
- func CIDRv4(value any) bool
- func CIDRv6(value any) bool
- func CUID(value any) bool
- func CUID2(value any) bool
- func E164(value any) bool
- func Email(value any) bool
- func Emoji(value any) bool
- func EndsWith(value any, suffix string) bool
- func GUID(value any) bool
- func Gt(value, limit any) bool
- func Gte(value, limit any) bool
- func IPv4(value any) bool
- func IPv6(value any) bool
- func ISODate(value any) bool
- func ISODateTime(value any) bool
- func ISODateTimeWithOptions(value any, options ISODateTimeOptions) bool
- func ISODuration(value any) bool
- func ISOTime(value any) bool
- func ISOTimeWithOptions(value any, options ISOTimeOptions) bool
- func Includes(value any, substring string) bool
- func JSON(value any) bool
- func JWT(value any) bool
- func JWTWithOptions(value any, options JWTOptions) bool
- func KSUID(value any) bool
- func Length(value any, expected int) bool
- func Lowercase(value any) bool
- func Lt(value, limit any) bool
- func Lte(value, limit any) bool
- func MaxLength(value any, maximum int) bool
- func MaxSize(value any, maximum int) bool
- func Mime(value any, allowedTypes []string) bool
- func MinLength(value any, minimum int) bool
- func MinSize(value any, minimum int) bool
- func MultipleOf(value, divisor any) bool
- func NanoID(value any) bool
- func Negative(value any) bool
- func NonNegative(value any) bool
- func NonPositive(value any) bool
- func Positive(value any) bool
- func Property(obj any, key string, validator func(any) bool) bool
- func Regex(value any, pattern *regexp.Regexp) bool
- func Size(value any, expected int) bool
- func StartsWith(value any, prefix string) bool
- func ULID(value any) bool
- func URL(value any) bool
- func URLWithOptions(value any, options URLOptions) bool
- func UUID(value any) bool
- func Uppercase(value any) bool
- func XID(value any) bool
- type ISODateTimeOptions
- type ISOTimeOptions
- type JWTOptions
- type URLOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ISODateTime ¶
ISODateTime validates if string is a valid ISO datetime format
func ISODateTimeWithOptions ¶ added in v0.3.0
func ISODateTimeWithOptions(value any, options ISODateTimeOptions) bool
ISODateTimeWithOptions validates if string is a valid ISO datetime format with options
func ISODuration ¶
ISODuration validates if string is a valid ISO 8601 duration format
func ISOTimeWithOptions ¶ added in v0.3.0
func ISOTimeWithOptions(value any, options ISOTimeOptions) bool
ISOTimeWithOptions validates if string is a valid ISO time format with options
func JWT ¶
JWT validates if string is a valid JWT token format This function only validates the JWT structure and basic claims It does NOT verify the signature (use JWTWithSecret for signature verification)
func JWTWithOptions ¶ added in v0.3.0
func JWTWithOptions(value any, options JWTOptions) bool
JWTWithOptions validates if string is a valid JWT token format with algorithm constraint This function only validates the JWT structure and basic claims It does NOT verify the signature (use JWTWithSecret for signature verification)
func MultipleOf ¶
MultipleOf validates if value is a multiple of the given divisor
func NonNegative ¶
NonNegative validates if numeric value is non-negative (>= 0)
func NonPositive ¶
NonPositive validates if numeric value is non-positive (<= 0)
func StartsWith ¶
StartsWith validates if string starts with the prefix
func URLWithOptions ¶ added in v0.3.0
func URLWithOptions(value any, options URLOptions) bool
URLWithOptions validates if string is a valid URL format with optional constraints
Types ¶
type ISODateTimeOptions ¶ added in v0.3.0
type ISODateTimeOptions struct {
// Precision specifies number of decimal places for seconds
// If nil, matches any number of decimal places
// If 0 or negative, no decimal places allowed
Precision *int
// Offset if true, allows timezone offsets like +01:00
Offset bool
// Local if true, makes the 'Z' timezone marker optional
Local bool
}
ISODateTimeOptions defines parameters for ISO datetime validation
type ISOTimeOptions ¶ added in v0.3.0
type ISOTimeOptions struct {
// Precision specifies number of decimal places for seconds
// If nil, matches any number of decimal places
// If 0 or negative, no decimal places allowed
// Special case: -1 means minute precision only (no seconds)
Precision *int
}
ISOTimeOptions defines parameters for ISO time validation
type JWTOptions ¶ added in v0.3.0
type JWTOptions struct {
// Algorithm specifies the expected signing algorithm
// If nil, any algorithm is accepted (not recommended for production)
Algorithm *string
}
JWTOptions defines options for JWT validation