Documentation
¶
Overview ¶
Time Validators
Index ¶
- Constants
- func Must(value time.Time, err error) time.Time
- func Validate(value time.Time, rules ...ValidationRule) (time.Time, error)
- func ValidateFromString(src string, location *time.Location, rules ...ValidationRule) (time.Time, error)
- func ValidateFromStringDateOnly(src string, location *time.Location, rules ...ValidationRule) (time.Time, error)
- func ValidateFromStringTimeOnly(src string, location *time.Location, rules ...ValidationRule) (time.Time, error)
- type ValidationRule
Constants ¶
View Source
const ( Type = "time" ParseErrorFormat = "Unable to parse time." MandatoryErrorFormat = "Must not be left empty." MinErrorFormat = "Cannot be less than '{{.min}}'." MaxErrorFormat = "Cannot be more than '{{.max}}'." BetweenErrorFormat = "Must be between '{{.min}}' and '{{.max}}'." )
Variables ¶
This section is empty.
Functions ¶
func ValidateFromString ¶
Types ¶
type ValidationRule ¶
func Mandatory ¶
func Mandatory() ValidationRule
Make sure value is set, if not set the rule return a validation error
Note: will only work while validating from string
func OverrideErrorMsg ¶
func OverrideErrorMsg(validationError vError.ValidationError, rules ...ValidationRule) ValidationRule
Override Error Message
Click to show internal directories.
Click to hide internal directories.