Documentation
¶
Index ¶
- func IsAlpha(value interface{}) bool
- func IsAlphaSpace(value interface{}) bool
- func IsAlphanumeric(value interface{}) bool
- func IsAlphanumericSpace(value interface{}) bool
- func IsContains(value interface{}, substring string) bool
- func IsEmail(value interface{}) bool
- func IsGreaterThan(value interface{}, min interface{}) (res bool)
- func IsGreaterThanEqual(value interface{}, min interface{}) (res bool)
- func IsIn(value interface{}, param ...string) bool
- func IsJSON(value interface{}) bool
- func IsLatitude(value interface{}) bool
- func IsLongitude(value interface{}) bool
- func IsLowerThan(value interface{}, max interface{}) (res bool)
- func IsLowerThanEqual(value interface{}, max interface{}) (res bool)
- func IsMatches(value interface{}, pattern string) bool
- func IsNotEmpty(value interface{}) bool
- func IsNotIn(value interface{}, param ...string) bool
- func IsNumeric(value interface{}) bool
- func IsOnRange(value interface{}, min interface{}, max interface{}) bool
- func IsSame(value interface{}, param interface{}) bool
- func IsURL(value interface{}) bool
- func ValidPhone(text string) (p string, e error)
- type Request
- type Response
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAlpha ¶
func IsAlpha(value interface{}) bool
IsAlpha check if the value contains only letters (a-zA-Z). Empty string is valid.
func IsAlphaSpace ¶
func IsAlphaSpace(value interface{}) bool
IsAlphaSpace check if the value contains only letters and space. Empty string is valid.
func IsAlphanumeric ¶
func IsAlphanumeric(value interface{}) bool
IsAlphanumeric check if the value contains only letters and numbers. Empty string is valid.
func IsAlphanumericSpace ¶
func IsAlphanumericSpace(value interface{}) bool
IsAlphanumericSpace check if the value contains only letters, numbers and space. Empty string is valid.
func IsContains ¶
IsContains check if the value contains the substring.
func IsGreaterThan ¶
func IsGreaterThan(value interface{}, min interface{}) (res bool)
IsGreaterThan return true if value is greather than given number this will evaluate value of int, lenght of string and number of slices.
func IsGreaterThanEqual ¶
func IsGreaterThanEqual(value interface{}, min interface{}) (res bool)
IsGreaterThanEqual return true if value is greather than equal given number this will evaluate value of int, lenght of string and number of slices.
func IsJSON ¶
func IsJSON(value interface{}) bool
IsJSON check if the value is valid JSON (note: uses json.Unmarshal).
func IsLatitude ¶
func IsLatitude(value interface{}) bool
IsLatitude check if the value is an latitude.
func IsLongitude ¶
func IsLongitude(value interface{}) bool
IsLongitude check if the value is an longitude.
func IsLowerThan ¶
func IsLowerThan(value interface{}, max interface{}) (res bool)
IsLowerThan return true if value is lower than given number this will evaluate value of int, lenght of string and number of slices.
func IsLowerThanEqual ¶
func IsLowerThanEqual(value interface{}, max interface{}) (res bool)
IsLowerThanEqual return true if value is greather than equal given number this will evaluate value of int, lenght of string and number of slices.
func IsMatches ¶
IsMatches check if value matches the pattern (pattern is regular expression) In case of error return false
func IsNotEmpty ¶
func IsNotEmpty(value interface{}) bool
IsNotEmpty returns true if value is not nill
func IsNumeric ¶
func IsNumeric(value interface{}) bool
IsNumeric check if the value contains only numbers.
func IsOnRange ¶
func IsOnRange(value interface{}, min interface{}, max interface{}) bool
IsOnRange return true if value is greather than equal given min and lowerthan than equal given max this will evaluate value of int, lenght of string and number of slices.
func IsSame ¶
func IsSame(value interface{}, param interface{}) bool
IsSame check if the value is identicaly same with given param
func ValidPhone ¶
Types ¶
type Response ¶
type Response struct {
Valid bool // state of validation
HeaderMessage string // header message in json
// contains filtered or unexported fields
}
Response format when running validations
func (*Response) GetFailures ¶
GetFailures return all failure message from validations.
func (*Response) GetMessages ¶
GetMessages return all error messages.
type Validator ¶
Validator holding the tag name and taglists available
func (*Validator) Field ¶
Field validates a value based on the provided tags and returns validator response