rules

package
v1.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rules

type Rules struct {
	Inputs reflect.Value
}

Rules struct to run dynamic method name

func (Rules) Dimensions added in v0.5.0

func (r Rules) Dimensions(fieldName string, v reflect.Value, m string) error

Dimensions validation image dimension with minimal width and height or maximal width and height. You can also set the ratio to validate.

func (Rules) Either added in v0.4.0

func (r Rules) Either(fieldName string, v reflect.Value, m string) error

Either as an OR operator to check value with different rules

func (Rules) EndWith

func (r Rules) EndWith(fieldName string, v reflect.Value, m string) error

EndWith to check if the end string has a specific prefix

func (Rules) Filesize added in v0.5.0

func (r Rules) Filesize(fieldName string, v reflect.Value, m string) error

Filesize validation file size. The file size cannot be exceeded the max.

func (Rules) IsAlpha

func (r Rules) IsAlpha(fieldName string, v reflect.Value) error

IsAlpha to check values is alpha or not

func (Rules) IsAlphanumeric

func (r Rules) IsAlphanumeric(fieldName string, v reflect.Value) error

IsAlphanumeric to check values is alphanumeric or not

func (Rules) IsArray

func (r Rules) IsArray(fieldName string, v reflect.Value) error

IsArray to check value is an array or not

func (Rules) IsBase64

func (r Rules) IsBase64(fieldName string, v reflect.Value) error

IsBase64 to check values is base64 or not

func (Rules) IsBool

func (r Rules) IsBool(fieldName string, v reflect.Value) error

IsBool to check value is a boolean or not

func (Rules) IsDate

func (r Rules) IsDate(fieldName string, v reflect.Value) error

IsDate to check values is date valid format or not

func (Rules) IsEmail

func (r Rules) IsEmail(fieldName string, v reflect.Value) error

IsEmail to check values is email address or not

func (Rules) IsFloat

func (r Rules) IsFloat(fieldName string, v reflect.Value) error

IsFloat to check value is a float32 or float64

func (Rules) IsIPv4

func (r Rules) IsIPv4(fieldName string, v reflect.Value) error

IsIPv4 to check values is ipv4 or not

func (Rules) IsIPv6

func (r Rules) IsIPv6(fieldName string, v reflect.Value) error

IsIPv6 to check values is ipv6 or not

func (Rules) IsISBN

func (r Rules) IsISBN(fieldName string, v reflect.Value) error

IsISBN to check values is ISBN or not

func (Rules) IsIn

func (r Rules) IsIn(fieldName string, v reflect.Value, in string) error

IsIn to check value in array strings

func (Rules) IsInt

func (r Rules) IsInt(fieldName string, v reflect.Value) error

IsInt to check value is a integer like int, int6, int8, int16, int32 or int64

func (Rules) IsLatitude

func (r Rules) IsLatitude(fieldName string, v reflect.Value) error

IsLatitude to check values is geo latitude or not

func (Rules) IsLongitude

func (r Rules) IsLongitude(fieldName string, v reflect.Value) error

IsLongitude to check values is geo longitude or not

func (Rules) IsNotIn

func (r Rules) IsNotIn(fieldName string, v reflect.Value, in string) error

IsNotIn to check value not in array strings

func (Rules) IsNumber

func (r Rules) IsNumber(fieldName string, v reflect.Value) error

IsNumber to check value is a number or not include integer and float

func (Rules) IsNumeric

func (r Rules) IsNumeric(fieldName string, v reflect.Value) error

IsNumeric to check value is a numeric or not

func (Rules) IsUUID

func (r Rules) IsUUID(fieldName string, v reflect.Value) error

IsUUID to check values is uuid, uuid3, uuid4 or uuid5

func (Rules) LengthBetween

func (r Rules) LengthBetween(fieldName string, v reflect.Value, m string) error

LengthBetween to check string values that have char length minimal and maximal

func (Rules) MaxLength

func (r Rules) MaxLength(fieldName string, v reflect.Value, m string) error

MaxLength to check string values that have char length maximal

func (Rules) MaxNumber added in v0.2.0

func (r Rules) MaxNumber(fieldName string, v reflect.Value, m string) error

MaxNumber to check number less than a minimal

func (Rules) Mimetype added in v0.5.0

func (r Rules) Mimetype(fieldName string, v reflect.Value, m string) error

Mimetype validation file. You see the full listing of MIME types at this link https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types

func (Rules) MinLength

func (r Rules) MinLength(fieldName string, v reflect.Value, m string) error

MinLength to check string values that have char length minimal

func (Rules) MinNumber added in v0.2.0

func (r Rules) MinNumber(fieldName string, v reflect.Value, m string) error

MinNumber to check number less than a minimal

func (Rules) NumberBetween added in v0.2.0

func (r Rules) NumberBetween(fieldName string, v reflect.Value, m string) error

NumberBetween to check number be less than maximal and be more than minimal

func (Rules) Required

func (r Rules) Required(fieldName string, field reflect.Value) error

Required to check value is empty or not becasue is required

func (Rules) RequiredIf added in v0.3.0

func (r Rules) RequiredIf(fieldName string, v reflect.Value, m string) error

RequiredIf to check another field is a match value

func (Rules) RequiredUnless added in v0.3.0

func (r Rules) RequiredUnless(fieldName string, v reflect.Value, m string) error

RequiredUnless to check another field is a doesn't match value

func (Rules) StartsWith

func (r Rules) StartsWith(fieldName string, v reflect.Value, m string) error

StartsWith to check if string has a specific prefix

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL