Documentation ¶
Index ¶
- func IsAlphanumericDash(str string) bool
- func IsAlphanumericUnderscoreDash(str string) bool
- func IsGreaterThanZero(value interface{}) error
- func IsOneOfString(set ...string) func(string) bool
- func IsOneOfStringICase(set ...string) func(string) bool
- func IsPtrToSliceOfUniqueStringersICase(set ...string) func(interface{}) error
- func IsValidIPv6CIDROrAddress(value interface{}) error
- func IsValidPortNumber(value interface{}) error
- func NoLineBreaks(str string) bool
- func NoPeriods(str string) bool
- func NoSpaces(str string) bool
- func StringIsValidFloat() *validation.StringRule
- func ToErrors(err map[string]error) []error
- type DBExistsRule
- type DBUniqueRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAlphanumericDash ¶
IsAlphanumericDash returns true if the string consists of only alphanumeric or dash characters.
func IsAlphanumericUnderscoreDash ¶
IsAlphanumericUnderscoreDash returns true if the string consists of only alphanumeric, underscore, or dash characters.
func IsGreaterThanZero ¶
func IsGreaterThanZero(value interface{}) error
func IsOneOfString ¶
IsOneOfString generates a validator function returning whether string is in the set of strings
func IsOneOfStringICase ¶
IsOneOfStringICase is a case-insensitive version of IsOneOfString
func IsPtrToSliceOfUniqueStringersICase ¶
IsPtrToSliceOfUniqueStringersICase returns a validator function which returns an error if the argument is a non-nil pointer to a slice of Stringers whose String() values are not in the set of strings or there are duplicate strings
func IsValidIPv6CIDROrAddress ¶
func IsValidIPv6CIDROrAddress(value interface{}) error
func IsValidPortNumber ¶
func IsValidPortNumber(value interface{}) error
func NoLineBreaks ¶
NoLineBreaks returns true if the string has no line breaks.
func StringIsValidFloat ¶
func StringIsValidFloat() *validation.StringRule
StringIsValidFloat returns a reference to a validation.StringRule function that only returns true if the string value given string argument can be parsed to a 64-bit float that is not NaN.
Types ¶
type DBExistsRule ¶
type DBExistsRule struct {
// contains filtered or unexported fields
}
DBExistsRule checks if value is in column in this table TODO: DBExistsRule ? what about DBUniqueRule?
func NewDBExistsRule ¶
func NewDBExistsRule(db *sqlx.DB, table string, column string) *DBExistsRule
NewDBExistsRule is a validation rule that checks if the given value is in the column in this table
func (*DBExistsRule) Error ¶
func (r *DBExistsRule) Error(message string) *DBExistsRule
Error sets the error message for the rule.
func (*DBExistsRule) Validate ¶
func (r *DBExistsRule) Validate(value interface{}) error
Validate checks if the given value is valid or not.
type DBUniqueRule ¶
type DBUniqueRule struct {
// contains filtered or unexported fields
}
DBUniqueRule checks if value is in column in this table TODO: DBUniqueRule ? what about DBUniqueRule?
func NewDBUniqueRule ¶
func NewDBUniqueRule(db *sqlx.DB, table string, column string, idCheck func(int) bool) *DBUniqueRule
NewDBUniqueRule is a validation rule that checks if the given value is in the column in this table
func (*DBUniqueRule) Error ¶
func (r *DBUniqueRule) Error(message string) *DBUniqueRule
Error sets the error message for the rule.
func (*DBUniqueRule) Validate ¶
func (r *DBUniqueRule) Validate(value interface{}) error
Validate returns an error if the value already exists in the table in this column