Documentation ¶
Index ¶
- Constants
- func ErrorMsg(fl validator.FieldLevel) bool
- func GetValidator() *validator.Validate
- func IsDate(fl validator.FieldLevel) bool
- func IsDatetime(fl validator.FieldLevel) bool
- func IsFloat(fl validator.FieldLevel) bool
- func IsInt(fl validator.FieldLevel) bool
- func IsNull(str string) bool
- func IsRFC3339(fl validator.FieldLevel) bool
- func IsRFC3339WithoutZone(fl validator.FieldLevel) bool
- func IsTime(str string, format string) bool
- func NotNull(fl validator.FieldLevel) bool
- func ValidateValuer(field reflect.Value) interface{}
- type Validate
Constants ¶
View Source
const ( Int string = "^(?:[-+]?(?:0|[1-9][0-9]*))$" Float string = "^(?:[-+]?(?:[0-9]+))?(?:\\.[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$" DateExp string = `\d{4}-\d{2}-\d{2}` RF3339WithoutZone string = "2006-01-02T15:04:05" )
Variables ¶
This section is empty.
Functions ¶
func ErrorMsg ¶
func ErrorMsg(fl validator.FieldLevel) bool
If an error message is set, then this field is not valid. Very useful for validation that cannot be done within the limits of the validate package. For example: Validating a DB unique constraint.
func GetValidator ¶
func GetValidator() *validator.Validate
func IsDate ¶
func IsDate(fl validator.FieldLevel) bool
IsRFC3339 check if string is valid timestamp value according to RFC3339
func IsInt ¶
func IsInt(fl validator.FieldLevel) bool
IsInt check if the string is an integer. Empty string is valid.
func IsRFC3339 ¶
func IsRFC3339(fl validator.FieldLevel) bool
IsRFC3339 check if string is valid timestamp value according to RFC3339
func IsRFC3339WithoutZone ¶
func IsRFC3339WithoutZone(fl validator.FieldLevel) bool
IsRFC3339WithoutZone check if string is valid timestamp value according to RFC3339 which excludes the timezone.
func NotNull ¶
func NotNull(fl validator.FieldLevel) bool
Used with sql.Null* types. If we get here, the value is not null, so just return true
func ValidateValuer ¶
ValidateValuer implements validator.CustomTypeFunc
Types ¶
Click to show internal directories.
Click to hide internal directories.