Documentation ¶
Index ¶
- type After
- type AfterOrEqual
- type Alpha
- type AlphaDash
- type AlphaNum
- type AlphaSpace
- type Array
- type Before
- type BeforeOrEqual
- type Between
- type Boolean
- type DateTime
- type DateTimeFormat
- type Different
- type Digits
- type DigitsBetween
- type Email
- type EndsWith
- type GreaterThan
- type GreaterThanEqual
- type In
- type Integer
- type Length
- type LessThan
- type LessThanEqual
- type Lowercase
- type Max
- type MaxDigits
- type MaxLength
- type Min
- type MinDigits
- type MinLength
- type NotEmpty
- type NotEqual
- type NotIn
- type NotRegex
- type Numeric
- type Regex
- type Required
- type RequiredIf
- type RequiredUnless
- type RequiredWith
- type RequiredWithAll
- type RequiredWithout
- type RequiredWithoutAll
- type Rule
- type RuleWithParams
- type SameAs
- type StartsWith
- type String
- type UUID
- type Uppercase
- type ValidationResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type After ¶
type After struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
After checks the field under validation be a value after the value of given field. It will return validation error if one or both of the field are not a valid datetime string. It also will return validation error if the other field could not be found in input bag.
Usage: "after:otherField[,timeZoneString]". Example: "after:start,America/New_York".
func (*After) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule accept 2 parameter, the first one, `otherField`, is mandatory and the second one, `timeZoneString` is optional.
type AfterOrEqual ¶
type AfterOrEqual struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
AfterOrEqual checks the field under validation be a value after or equal to the value of given field. It will return validation error if one or both of the field are not a valid datetime string. It also will return validation error if the other field could not be found in input bag.
Usage: "afterOrEqual:otherField[,timeZoneString]". Example: "afterOrEqual:start,America/New_York".
func (*AfterOrEqual) AddParams ¶
func (r *AfterOrEqual) AddParams(params []string)
AddParams adds rules parameter values to the rule instance.
func (*AfterOrEqual) MinRequiredParams ¶
func (*AfterOrEqual) MinRequiredParams() int
MinRequiredParams returns minimum parameter requirement for this rule. This rule accept 2 parameter, the first one, `otherField`, is mandatory and the second one, `timeZoneString` is optional.
func (*AfterOrEqual) Validate ¶
func (r *AfterOrEqual) Validate(selector string, value any, inputBag bag.InputBag) ValidationResult
Validate does the validation process of the rule. See struct documentation for more details.
type Alpha ¶
type Alpha struct {
translation.BaseTranslatableRule
}
Alpha checks the field under validation be entirely alphabetic characters. This rule accept no parameters.
Usage: "alpha".
type AlphaDash ¶
type AlphaDash struct {
translation.BaseTranslatableRule
}
AlphaDash checks the field under validation has alphanumeric characters, as well as dashes and underscore. This rule accept no parameters.
Usage: "alphaDash".
type AlphaNum ¶
type AlphaNum struct {
translation.BaseTranslatableRule
}
AlphaNum checks the field under validation has alphanumeric characters. This rule accept no parameters.
Usage: "alphaNum".
type AlphaSpace ¶
type AlphaSpace struct {
translation.BaseTranslatableRule
}
AlphaSpace checks the field under validation have alphabetic characters and spaces. This rule accept no parameters.
Usage: "alphaSpace".
func (*AlphaSpace) Validate ¶
func (r *AlphaSpace) Validate(selector string, value any, _ bag.InputBag) ValidationResult
Validate does the validation process of the rule. See struct documentation for more details.
type Array ¶
type Array struct {
translation.BaseTranslatableRule
}
Array checks the field under validation is an array or slice. This rule accept no parameters.
Usage: "array".
type Before ¶
type Before struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
Before checks the field under validation be a value before the value of given field. It will return validation error if one or both of the field are not a valid datetime string. It also will return validation error if the other field could not be found in input bag.
Usage: "before:otherField[,timeZoneString]. Example: "before:end,America/New_York".
func (*Before) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule accept 2 parameter, the first one, `otherField`, is mandatory and the second one, `timeZoneString` is optional.
type BeforeOrEqual ¶
type BeforeOrEqual struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
BeforeOrEqual checks the field under validation be a value before or equal to the value of given field. It will return validation error if one or both of the field are not a valid datetime string. It also will return validation error if the other field could not be found in input bag.
Usage: "beforeOrEqual:otherField[,timeZoneString]. Example: "beforeOrEqual:end,America/New_York".
func (*BeforeOrEqual) AddParams ¶
func (r *BeforeOrEqual) AddParams(params []string)
AddParams adds rules parameter values to the rule instance.
func (*BeforeOrEqual) MinRequiredParams ¶
func (*BeforeOrEqual) MinRequiredParams() int
MinRequiredParams returns minimum parameter requirement for this rule. This rule accept 2 parameter, the first one, `otherField`, is mandatory and the second one, `timeZoneString` is optional.
func (*BeforeOrEqual) Validate ¶
func (r *BeforeOrEqual) Validate(selector string, value any, inputBag bag.InputBag) ValidationResult
Validate does the validation process of the rule. See struct documentation for more details.
type Between ¶
type Between struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
Between checks the field under validation have a value or a length between the given min and max parameters. If the field under validation has a numeric value, the value must be between the given min and max. If the field under validation is string, slice or map, the length of it will be evaluated.
Usage: "between:min,max". Example: "between:2,5".
func (*Between) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule accept 2 parameter, the first one is the minimum number and the second one is the maximum number of the between range. Both of the parameters are mandatory.
type Boolean ¶
type Boolean struct {
translation.BaseTranslatableRule
}
Boolean checks the field under validation is boolean or can be cast as a boolean value.
Usage: "boolean".
type DateTime ¶
type DateTime struct {
translation.BaseTranslatableRule
}
DateTime checks the field under validation be a valid datetime string, and it is castable to time.Time.
Usage: "datetime".
type DateTimeFormat ¶
type DateTimeFormat struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
DateTimeFormat checks the field under validation be a valid datetime string and match the given format.
Usage: "datetimeFormat:format". Example: "datetimeFormat:2006-01-02T15:04:05Z07:00".
func (*DateTimeFormat) AddParams ¶
func (r *DateTimeFormat) AddParams(params []string)
AddParams adds rules parameter values to the rule instance.
func (*DateTimeFormat) MinRequiredParams ¶
func (*DateTimeFormat) MinRequiredParams() int
MinRequiredParams returns minimum parameter requirement for this rule. This rule accept only one parameter, the time layout, which is a mandatory parameter.
func (*DateTimeFormat) Validate ¶
func (r *DateTimeFormat) Validate(selector string, value any, inputBag bag.InputBag) ValidationResult
Validate does the validation process of the rule. See struct documentation for more details.
type Different ¶
type Different struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
Different checks the field under validation has different value than the given field.
Usage: "different:otherField". Example" "different:oldPassword".
func (*Different) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule accept only one parameter, and that is `otherField`. This parameter is mandatory.
type Digits ¶
type Digits struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
Digits checks the field under validation has an exact length digits.
Usage: "digits:numberOfDigit". Example: "digits:5".
func (*Digits) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule accept only 1 parameter, which is number of digits and is mandatory.
type DigitsBetween ¶
type DigitsBetween struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
DigitsBetween checks the field under validation has length between given min and max.
Usage: "digitsBetween:minDigits,maxDigits". Example: "digitsBetween:4,6".
func (*DigitsBetween) AddParams ¶
func (r *DigitsBetween) AddParams(params []string)
AddParams adds rules parameter values to the rule instance.
func (*DigitsBetween) MinRequiredParams ¶
func (*DigitsBetween) MinRequiredParams() int
MinRequiredParams returns minimum parameter requirement for this rule. This rule accept 2 parameters, min and max.
func (*DigitsBetween) Validate ¶
func (r *DigitsBetween) Validate(selector string, value any, _ bag.InputBag) ValidationResult
Validate does the validation process of the rule. See struct documentation for more details.
type Email ¶
type Email struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
Email checks the field under validation is a valid email address based on RFC 53222. There is also an optional mx record check, you can enable by passing `mx` as parameter.
Usage: "email[:mx]. Example: "email". Example: "email:mx".
func (*Email) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule accept `mx` as the only and optional parameter. By passing this parameter, an extra step will be added to validation process. The `mx` validation checks the email domain for mx record.
type EndsWith ¶
type EndsWith struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
EndsWith check the field under validation ends with given sub string.
Usage: "endsWith:suffix". Example: "endsWith:Model".
func (*EndsWith) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule needs only one parameter and that is the prefix.
type GreaterThan ¶
type GreaterThan struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
GreaterThan checks the field under validation has a value or a length greater than the given value.
Usage: "gt:value". Example: "gt:18".
func (*GreaterThan) AddParams ¶
func (r *GreaterThan) AddParams(params []string)
AddParams adds rules parameter values to the rule instance.
func (*GreaterThan) MinRequiredParams ¶
func (*GreaterThan) MinRequiredParams() int
MinRequiredParams returns minimum parameter requirement for this rule. This rule needs only 1 parameter that is the `value`.
func (*GreaterThan) Validate ¶
func (r *GreaterThan) Validate(selector string, value any, _ bag.InputBag) ValidationResult
Validate does the validation process of the rule. See struct documentation for more details.
type GreaterThanEqual ¶
type GreaterThanEqual struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
GreaterThanEqual checks the field under validation has a value or a length greater than or equal to the given value.
Usage: "gte:value". Example: "gte:18".
func (*GreaterThanEqual) AddParams ¶
func (r *GreaterThanEqual) AddParams(params []string)
AddParams adds rules parameter values to the rule instance.
func (*GreaterThanEqual) MinRequiredParams ¶
func (*GreaterThanEqual) MinRequiredParams() int
MinRequiredParams returns minimum parameter requirement for this rule. This rule needs only 1 parameter that is the `value`.
func (*GreaterThanEqual) Validate ¶
func (r *GreaterThanEqual) Validate(selector string, value any, _ bag.InputBag) ValidationResult
Validate does the validation process of the rule. See struct documentation for more details.
type In ¶
type In struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
In checks the field under validation be in one of given values.
Usage: "in:value1,value2[,value3,...]. Example: "in:EUR,USD,GBP".
func (*In) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule needs at least 2 parameter or more.
type Integer ¶
type Integer struct {
translation.BaseTranslatableRule
}
Integer checks the field under validation has a integer value
Usage: "integer".
type Length ¶
type Length struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
Length checks the field under validation have exact given length.
Usage: "length:value". Example: "length:10".
func (*Length) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule need only one parameter that is the `length`.
type LessThan ¶
type LessThan struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
LessThan checks the field under validation has a value or a length less than the given value.
Usage: "lt:value". Example: "lt:18".
func (*LessThan) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule needs only 1 parameter that is the `value`.
type LessThanEqual ¶
type LessThanEqual struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
LessThanEqual checks the field under validation has a value or a length less than the given value.
Usage: "lte:value". Example: "lte:18".
func (*LessThanEqual) AddParams ¶
func (r *LessThanEqual) AddParams(params []string)
AddParams adds rules parameter values to the rule instance.
func (*LessThanEqual) MinRequiredParams ¶
func (*LessThanEqual) MinRequiredParams() int
MinRequiredParams returns minimum parameter requirement for this rule. This rule needs only 1 parameter that is the `value`.
func (*LessThanEqual) Validate ¶
func (r *LessThanEqual) Validate(selector string, value any, _ bag.InputBag) ValidationResult
Validate does the validation process of the rule. See struct documentation for more details.
type Lowercase ¶
type Lowercase struct {
translation.BaseTranslatableRule
}
Lowercase checks the field under validation be lowercase string.
Usage: "lowercase".
type Max ¶
type Max struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
Max checks the field under validation value be less than given value.
Usage: "max:value". Example: "max:10".
func (*Max) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule need only one parameter that is the `maxValue`.
type MaxDigits ¶
type MaxDigits struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
MaxDigits checks the field under validation has length less than given max digits.
Usage: "maxDigits:numberOfDigit". Example: "maxDigits:5".
func (*MaxDigits) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule accept only 1 parameter, which is number of maxDigits and is mandatory.
type MaxLength ¶
type MaxLength struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
MaxLength checks the field under validation length did not reach given length.
Usage: "maxLength:value". Example: "maxLength:10".
func (*MaxLength) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule need only one parameter that is the `length`.
type Min ¶
type Min struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
Min checks the field under validation value be greater than given value.
Usage: "min:value". Example: "min:10".
func (*Min) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule need only one parameter that is the `minValue`.
type MinDigits ¶
type MinDigits struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
MinDigits checks the field under validation has length more than given min digits.
Usage: "minDigits:numberOfDigit". Example: "minDigits:5".
func (*MinDigits) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule accept only 1 parameter, which is number of minDigits and is mandatory.
type MinLength ¶
type MinLength struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
MinLength checks the field under validation length be greater than given length.
Usage: "minLength:value". Example: "minLength:10".
func (*MinLength) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule need only one parameter that is the `length`.
type NotEmpty ¶
type NotEmpty struct {
translation.BaseTranslatableRule
}
NotEmpty checks the field under validation be a non-empty or non-zero value.
Usage: "notEmpty".
type NotEqual ¶
type NotEqual struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
NotEqual checks the field under validation is not equal to given value.
Usage: "neq:value". Example: "neq:admin".
func (*NotEqual) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule only needs one parameter and that is the `value`.
type NotIn ¶
type NotIn struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
NotIn checks the field under validation not be in one of given values.
Usage: "notIn:value1,value2[,value3,...]". Example: "notIn:admin,superuser".
func (*NotIn) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule needs at least 2 parameter or more.
type NotRegex ¶
type NotRegex struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
NotRegex checks the field under validation does not match the given regex pattern.
Usage: "notRegex:pattern". Example: "notRegex:[a-zA-Z0-9]+".
func (*NotRegex) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule needs only one parameter and that is the regex pattern.
type Numeric ¶
type Numeric struct {
translation.BaseTranslatableRule
}
Numeric checks the field under validation has a numeric value.
Usage: "numeric".
type Regex ¶
type Regex struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
Regex check the field under validation match the given regex pattern.
Usage: "regex:pattern". Example: "regex:[a-zA-Z0-9]+".
func (*Regex) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule needs only one parameter and that is the regex pattern.
type Required ¶
type Required struct {
translation.BaseTranslatableRule
}
Required checks the field under validation exists.
Usage: "required".
type RequiredIf ¶
type RequiredIf struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
RequiredIf check the field under validation exists if the given condition is true. The condition is consists of another field name and a value. If the value of the other field is equal to the given value, the field under validation is required. Note that the only supported type for value parameter is string.
Usage: "requiredIf:otherField,value". example: "requiredIf:type,user".
func (*RequiredIf) AddParams ¶
func (r *RequiredIf) AddParams(params []string)
AddParams adds rules parameter values to the rule instance.
func (*RequiredIf) MinRequiredParams ¶
func (*RequiredIf) MinRequiredParams() int
MinRequiredParams returns minimum parameter requirement for this rule. This rule accept 2 parameter, `otherField`, and `value`. Both parameters are mandatory.
func (*RequiredIf) Validate ¶
func (r *RequiredIf) Validate(selector string, _ any, inputBag bag.InputBag) ValidationResult
Validate does the validation process of the rule. See struct documentation for more details.
type RequiredUnless ¶
type RequiredUnless struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
RequiredUnless check the field under validation exists unless the given condition is true. The condition is consists of another field name and a value. Unless the value of the other field is equal to the given value, the field under validation is required. Note that the only supported type for value parameter is string.
Usage: "requiredUnless:otherField,value". example: "requiredUnless:type,user".
func (*RequiredUnless) AddParams ¶
func (r *RequiredUnless) AddParams(params []string)
AddParams adds rules parameter values to the rule instance.
func (*RequiredUnless) MinRequiredParams ¶
func (*RequiredUnless) MinRequiredParams() int
MinRequiredParams returns minimum parameter requirement for this rule. This rule accept 2 parameter, `otherField`, and `value`. Both parameters are mandatory.
func (*RequiredUnless) Validate ¶
func (r *RequiredUnless) Validate(selector string, _ any, inputBag bag.InputBag) ValidationResult
Validate does the validation process of the rule. See struct documentation for more details.
type RequiredWith ¶
type RequiredWith struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
RequiredWith check the field under validation exists if any of given fields exist.
Usage: "requiredWith:otherField[,anotherField,...]". example: "requiredWith:type".
func (*RequiredWith) AddParams ¶
func (r *RequiredWith) AddParams(params []string)
AddParams adds rules parameter values to the rule instance.
func (*RequiredWith) MinRequiredParams ¶
func (*RequiredWith) MinRequiredParams() int
MinRequiredParams returns minimum parameter requirement for this rule. This rule needs at least 1 parameter which represent the name of other field or fields.
func (*RequiredWith) Validate ¶
func (r *RequiredWith) Validate(selector string, _ any, inputBag bag.InputBag) ValidationResult
Validate does the validation process of the rule. See struct documentation for more details.
type RequiredWithAll ¶
type RequiredWithAll struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
RequiredWithAll check the field under validation exists if all given fields exist.
Usage: "requiredWith:otherField,anotherField[,...]". example: "requiredWith:type,username".
func (*RequiredWithAll) AddParams ¶
func (r *RequiredWithAll) AddParams(params []string)
AddParams adds rules parameter values to the rule instance.
func (*RequiredWithAll) MinRequiredParams ¶
func (*RequiredWithAll) MinRequiredParams() int
MinRequiredParams returns minimum parameter requirement for this rule. This rule needs at least 2 parameters which represent the name of other field or fields.
func (*RequiredWithAll) Validate ¶
func (r *RequiredWithAll) Validate(selector string, _ any, inputBag bag.InputBag) ValidationResult
Validate does the validation process of the rule. See struct documentation for more details.
type RequiredWithout ¶
type RequiredWithout struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
RequiredWithout check the field under validation exists if any of given fields doesn't exist.
Usage: "requiredWithout:otherField[,anotherField,...]". example: "requiredWithout:username".
func (*RequiredWithout) AddParams ¶
func (r *RequiredWithout) AddParams(params []string)
AddParams adds rules parameter values to the rule instance.
func (*RequiredWithout) MinRequiredParams ¶
func (*RequiredWithout) MinRequiredParams() int
MinRequiredParams returns minimum parameter requirement for this rule. This rule needs at least 1 parameter which represent the name of other field or fields.
func (*RequiredWithout) Validate ¶
func (r *RequiredWithout) Validate(selector string, _ any, inputBag bag.InputBag) ValidationResult
Validate does the validation process of the rule. See struct documentation for more details.
type RequiredWithoutAll ¶
type RequiredWithoutAll struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
RequiredWithoutAll check the field under validation exists if all given fields not exist.
Usage: "requiredWithout:otherField,anotherField[,...]". example: "requiredWithout:phone,username".
func (*RequiredWithoutAll) AddParams ¶
func (r *RequiredWithoutAll) AddParams(params []string)
AddParams adds rules parameter values to the rule instance.
func (*RequiredWithoutAll) MinRequiredParams ¶
func (*RequiredWithoutAll) MinRequiredParams() int
MinRequiredParams returns minimum parameter requirement for this rule. This rule needs at least 2 parameters which represent the name of other field or fields.
func (*RequiredWithoutAll) Validate ¶
func (r *RequiredWithoutAll) Validate(selector string, _ any, inputBag bag.InputBag) ValidationResult
Validate does the validation process of the rule. See struct documentation for more details.
type Rule ¶
type Rule interface {
Validate(selector string, value any, inputBag bag.InputBag) ValidationResult
}
Rule is an interface for rules.
type RuleWithParams ¶
RuleWithParams is an interface for rules that have parameters.
type SameAs ¶
type SameAs struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
SameAs check the field under validation has the value same as the other given field.
Usage: "sameAs:otherField". Example: "sameAs:password".
func (*SameAs) MinRequiredParams ¶
MinRequiredParams returns minimum parameter requirement for this rule. This rule needs only one parameter and that is the regex pattern.
type StartsWith ¶
type StartsWith struct { translation.BaseTranslatableRule // contains filtered or unexported fields }
StartsWith check the field under validation starts with given sub string.
Usage: "startsWith:prefix". Example: "startsWith:Model".
func (*StartsWith) AddParams ¶
func (r *StartsWith) AddParams(params []string)
AddParams adds rules parameter values to the rule instance.
func (*StartsWith) MinRequiredParams ¶
func (*StartsWith) MinRequiredParams() int
MinRequiredParams returns minimum parameter requirement for this rule. This rule needs only one parameter and that is the prefix.
func (*StartsWith) Validate ¶
func (r *StartsWith) Validate(selector string, value any, _ bag.InputBag) ValidationResult
Validate does the validation process of the rule. See struct documentation for more details.
type String ¶
type String struct {
translation.BaseTranslatableRule
}
String checks the field under validation has a string value
Usage: "string".
type UUID ¶
type UUID struct {
translation.BaseTranslatableRule
}
UUID checks field under validation is a valid uuid.
Usage: "uuid".
type Uppercase ¶
type Uppercase struct {
translation.BaseTranslatableRule
}
Uppercase checks the field under validation be uppercase string.
Usage: "uppercase".
type ValidationResult ¶
type ValidationResult struct {
// contains filtered or unexported fields
}
ValidationResult is a struct represents a single validation result.
func NewFailedResult ¶
func NewFailedResult(message string) ValidationResult
NewFailedResult generates a ValidationResult instance as failed validation with given error message.
func NewResult ¶
func NewResult(valid bool, message string) ValidationResult
NewResult generates a ValidationResult instance with given values.
func NewSuccessResult ¶
func NewSuccessResult() ValidationResult
NewSuccessResult generates a ValidationResult instance as a success result.
func (ValidationResult) Failed ¶
func (r ValidationResult) Failed() bool
Failed returns true if the validation has failed.
func (ValidationResult) Message ¶
func (r ValidationResult) Message() string
Message returns the message stored in the ValidationResult instance.
Source Files ¶
- after.go
- after_or_equal.go
- alpha.go
- alpha_dash.go
- alpha_num.go
- alpha_space.go
- array.go
- before.go
- before_or_equal.go
- between.go
- boolean.go
- contracts.go
- datetime.go
- datetime_format.go
- different.go
- digits.go
- digits_between.go
- email.go
- ends_with.go
- gt.go
- gte.go
- helpers.go
- in.go
- integer.go
- length.go
- lowercase.go
- lt.go
- lte.go
- max.go
- max_digits.go
- max_length.go
- min.go
- min_digits.go
- min_length.go
- neq.go
- not_empty.go
- not_in.go
- not_regex.go
- numeric.go
- regex.go
- required.go
- required_if.go
- required_unless.go
- required_with.go
- required_with_all.go
- required_without.go
- required_without_all.go
- same_as.go
- starts_with.go
- string.go
- uppercase.go
- uuid.go