Documentation
¶
Index ¶
- Variables
- func ASCII(str string) bool
- func Alpha(str string) bool
- func AlphaUnicode(str string) bool
- func Alphanumeric(str string) bool
- func AlphanumericUnicode(str string) bool
- func Base64(s string) bool
- func Base64URL(str string) bool
- func Between(val, min, max any) bool
- func Boolean[T any](t T) bool
- func Color(str string) bool
- func Compare(srcVal, dstVal any, op string) bool
- func Datetime(str, layout string) bool
- func Default(val any) bool
- func Dir(val any) bool
- func E164(str string) bool
- func Email(str string) bool
- func Empty[T any](t T) bool
- func Equal(a, b any) bool
- func File(val any) bool
- func GreaterEqualThan(a, b any) bool
- func GreaterThan(a, b any) bool
- func HEXColor(str string) bool
- func HSL(str string) bool
- func HSLA(str string) bool
- func HTML(str string) bool
- func HTMLEncoded(str string) bool
- func HasValue(val any) bool
- func Hexadecimal(str string) bool
- func IP(str string) bool
- func IPv4(str string) bool
- func IPv6(str string) bool
- func JSON[T any](t T) bool
- func JWT(str string) bool
- func Label(s string) bool
- func Latitude[T any](t T) bool
- func Length(val any, length int, op string) bool
- func LengthBetween(val any, min, max int) bool
- func LessEqualThan(a, b any) bool
- func LessThan(a, b any) bool
- func Longitude[T any](t T) bool
- func Lowercase(str string) bool
- func MAC(str string) bool
- func MD4(str string) bool
- func MD5(str string) bool
- func NotBetween(val, min, max any) bool
- func NotEmpty[T any](t T) bool
- func NotEqual(a, b any) bool
- func Number[T any](t T) bool
- func Numeric[T any](t T) bool
- func OneOf(val any, vals []any) bool
- func PhoneNumber(s string) bool
- func RGB(str string) bool
- func RGBA(str string) bool
- func SHA256(str string) bool
- func SHA384(str string) bool
- func SHA512(str string) bool
- func Semver(s string) bool
- func Timezone(str string) bool
- func ULID(str string) bool
- func URL(s string) bool
- func URLEncoded(str string) bool
- func UUID(str string) bool
- func UUID3(str string) bool
- func UUID4(str string) bool
- func UUID5(str string) bool
- func Uppercase(str string) bool
Constants ¶
This section is empty.
Variables ¶
var ( ErrBadType = errors.New("bad value type") ErrBadRange = errors.New("bad value range") )
Functions ¶
func ASCII ¶
ASCII is the validation function for validating if the field's value is a valid ASCII character.
func Alpha ¶
Alpha is the validation function for validating if the current field's value is a valid alpha value.
func AlphaUnicode ¶
AlphaUnicode is the validation function for validating if the current field's value is a valid alpha unicode value.
func Alphanumeric ¶
Alphanumeric is the validation function for validating if the current field's value is a valid alphanumeric value.
func AlphanumericUnicode ¶
AlphanumericUnicode is the validation function for validating if the current field's value is a valid alphanumeric unicode value.
func Boolean ¶
Boolean is the validation function for validating if the current field's value can be safely converted to a boolean.
func Compare ¶
Compare intX,floatX value by given op. returns `srcVal op(=,!=,<,<=,>,>=) dstVal`
Usage:
compare(2, 3, ">") // false compare(2, 1.3, ">") // true compare(2.2, 1.3, ">") // true compare(2.1, 2, ">") // true
func Dir ¶
Dir is the validation function for validating if the current field's value is a valid directory.
func Empty ¶
Empty checks if a value is empty or not. A value is considered empty if - integer, float: zero - bool: false - string, array: len() == 0 - slice, map: nil or len() == 0 - interface, pointer: nil or the referenced value is empty
func Equal ¶
Equal is the validation function for validating if the current field's value is equal to the param's value.
func File ¶
File is the validation function for validating if the current field's value is a valid file path.
func GreaterEqualThan ¶
GreaterEqualThan is the validation function for validating if the current field's value is greater than or equal to the param's value.
func GreaterThan ¶
GreaterThan is the validation function for validating if the current field's value is greater than the param's value.
func HEXColor ¶
HEXColor is the validation function for validating if the current field's value is a valid HEX color.
func HSL ¶
HSL is the validation function for validating if the current field's value is a valid HSL color.
func HSLA ¶
HSLA is the validation function for validating if the current field's value is a valid HSLA color.
func HTMLEncoded ¶
func HasValue ¶
HasValue is the validation function for validating if the current field's value is not the default static value.
func Hexadecimal ¶
Hexadecimal is the validation function for validating if the current field's value is a valid hexadecimal.
func IP ¶
IP is the validation function for validating if the field's value is a valid v4 or v6 IP address.
func IPv6 ¶
IPv6 is the validation function for validating if the field's value is a valid v6 IP address.
func JSON ¶
JSON is the validation function for validating if the current field's value is a valid json string.
func JWT ¶
JWT is the validation function for validating if the current field's value is a valid JWT string.
func Latitude ¶
Latitude is the validation function for validating if the field's value is a valid latitude coordinate.
func LengthBetween ¶
func LessEqualThan ¶
LessEqualThan is the validation function for validating if the current field's value is less than or equal to the param's value.
func LessThan ¶
LessThan is the validation function for validating if the current field's value is less than the param's value.
func Longitude ¶
Longitude is the validation function for validating if the field's value is a valid longitude coordinate.
func Lowercase ¶
Lowercase is the validation function for validating if the current field's value is a lowercase string.
func MAC ¶
MAC is the validation function for validating if the field's value is a valid MAC address.
func NotBetween ¶
func Number ¶
Number is the validation function for validating if the current field's value is a valid number.
func Numeric ¶
Numeric is the validation function for validating if the current field's value is a valid numeric value.
func RGB ¶
RGB is the validation function for validating if the current field's value is a valid RGB color.
func RGBA ¶
RGBA is the validation function for validating if the current field's value is a valid RGBA color.
func SHA256 ¶
SHA256 is the validation function for validating if the field's value is a valid SHA256.
func SHA384 ¶
SHA384 is the validation function for validating if the field's value is a valid SHA384.
func SHA512 ¶
SHA512 is the validation function for validating if the field's value is a valid SHA512.
func Timezone ¶
Timezone is the validation function for validating if the current field's value is a valid time zone string.
func URLEncoded ¶
func UUID ¶
UUID is the validation function for validating if the field's value is a valid UUID of any version.
func UUID3 ¶
UUID3 is the validation function for validating if the field's value is a valid v3 UUID.
func UUID4 ¶
UUID4 is the validation function for validating if the field's value is a valid v4 UUID.
Types ¶
This section is empty.