Documentation ¶
Index ¶
- Constants
- func ErrorLengthEqualTo(length int, limit int) error
- func ErrorLengthNotEqualTo(length int, limit int) error
- func ErrorLengthNotGreaterThan(length int, limit int) error
- func ErrorLengthNotGreaterThanOrEqualTo(length int, limit int) error
- func ErrorLengthNotInRange(length int, lowerLimit int, upperLimit int) error
- func ErrorLengthNotLessThan(length int, limit int) error
- func ErrorLengthNotLessThanOrEqualTo(length int, limit int) error
- func ErrorValueBooleanNotFalse() error
- func ErrorValueBooleanNotTrue() error
- func ErrorValueDuplicate() error
- func ErrorValueEmpty() error
- func ErrorValueEqualTo(value interface{}, limit interface{}) error
- func ErrorValueExists() error
- func ErrorValueFloat64NotOneOf(value float64, allowedValues []float64) error
- func ErrorValueFloat64OneOf(value float64, disallowedValues []float64) error
- func ErrorValueIntNotOneOf(value int, allowedValues []int) error
- func ErrorValueIntOneOf(value int, disallowedValues []int) error
- func ErrorValueNotEmpty() error
- func ErrorValueNotEqualTo(value interface{}, limit interface{}) error
- func ErrorValueNotExists() error
- func ErrorValueNotGreaterThan(value interface{}, limit interface{}) error
- func ErrorValueNotGreaterThanOrEqualTo(value interface{}, limit interface{}) error
- func ErrorValueNotInRange(value interface{}, lowerLimit interface{}, upperLimit interface{}) error
- func ErrorValueNotLessThan(value interface{}, limit interface{}) error
- func ErrorValueNotLessThanOrEqualTo(value interface{}, limit interface{}) error
- func ErrorValueStringAsTimeNotValid(value string, layout string) error
- func ErrorValueStringMatches(value string, expression *regexp.Regexp) error
- func ErrorValueStringNotMatches(value string, expression *regexp.Regexp) error
- func ErrorValueStringNotOneOf(value string, allowedValues []string) error
- func ErrorValueStringOneOf(value string, disallowedValues []string) error
- func ErrorValueTimeNotAfter(value time.Time, limit time.Time) error
- func ErrorValueTimeNotAfterNow(value time.Time) error
- func ErrorValueTimeNotBefore(value time.Time, limit time.Time) error
- func ErrorValueTimeNotBeforeNow(value time.Time) error
- type Array
- type Bool
- type Float64
- func (f *Float64) EqualTo(value float64) structure.Float64
- func (f *Float64) Exists() structure.Float64
- func (f *Float64) GreaterThan(limit float64) structure.Float64
- func (f *Float64) GreaterThanOrEqualTo(limit float64) structure.Float64
- func (f *Float64) InRange(lowerLimit float64, upperLimit float64) structure.Float64
- func (f *Float64) LessThan(limit float64) structure.Float64
- func (f *Float64) LessThanOrEqualTo(limit float64) structure.Float64
- func (f *Float64) NotEqualTo(value float64) structure.Float64
- func (f *Float64) NotExists() structure.Float64
- func (f *Float64) NotOneOf(disallowedValues ...float64) structure.Float64
- func (f *Float64) OneOf(allowedValues ...float64) structure.Float64
- func (f *Float64) Using(usingFunc structure.Float64UsingFunc) structure.Float64
- type Int
- func (i *Int) EqualTo(value int) structure.Int
- func (i *Int) Exists() structure.Int
- func (i *Int) GreaterThan(limit int) structure.Int
- func (i *Int) GreaterThanOrEqualTo(limit int) structure.Int
- func (i *Int) InRange(lowerLimit int, upperLimit int) structure.Int
- func (i *Int) LessThan(limit int) structure.Int
- func (i *Int) LessThanOrEqualTo(limit int) structure.Int
- func (i *Int) NotEqualTo(value int) structure.Int
- func (i *Int) NotExists() structure.Int
- func (i *Int) NotOneOf(disallowedValues ...int) structure.Int
- func (i *Int) OneOf(allowedValues ...int) structure.Int
- func (i *Int) Using(usingFunc structure.IntUsingFunc) structure.Int
- type Object
- type String
- func (s *String) AsTime(layout string) structure.Time
- func (s *String) Empty() structure.String
- func (s *String) EqualTo(value string) structure.String
- func (s *String) Exists() structure.String
- func (s *String) LengthEqualTo(limit int) structure.String
- func (s *String) LengthGreaterThan(limit int) structure.String
- func (s *String) LengthGreaterThanOrEqualTo(limit int) structure.String
- func (s *String) LengthInRange(lowerLimit int, upperLimit int) structure.String
- func (s *String) LengthLessThan(limit int) structure.String
- func (s *String) LengthLessThanOrEqualTo(limit int) structure.String
- func (s *String) LengthNotEqualTo(limit int) structure.String
- func (s *String) Matches(expression *regexp.Regexp) structure.String
- func (s *String) NotEmpty() structure.String
- func (s *String) NotEqualTo(value string) structure.String
- func (s *String) NotExists() structure.String
- func (s *String) NotMatches(expression *regexp.Regexp) structure.String
- func (s *String) NotOneOf(disallowedValues ...string) structure.String
- func (s *String) OneOf(allowedValues ...string) structure.String
- func (s *String) Using(usingFunc structure.StringUsingFunc) structure.String
- type StringArray
- func (s *StringArray) Each(eachFunc structure.StringEachFunc) structure.StringArray
- func (s *StringArray) EachMatches(expression *regexp.Regexp) structure.StringArray
- func (s *StringArray) EachNotEmpty() structure.StringArray
- func (s *StringArray) EachNotMatches(expression *regexp.Regexp) structure.StringArray
- func (s *StringArray) EachNotOneOf(disallowedValues ...string) structure.StringArray
- func (s *StringArray) EachOneOf(allowedValues ...string) structure.StringArray
- func (s *StringArray) EachUnique() structure.StringArray
- func (s *StringArray) Empty() structure.StringArray
- func (s *StringArray) Exists() structure.StringArray
- func (s *StringArray) LengthEqualTo(limit int) structure.StringArray
- func (s *StringArray) LengthGreaterThan(limit int) structure.StringArray
- func (s *StringArray) LengthGreaterThanOrEqualTo(limit int) structure.StringArray
- func (s *StringArray) LengthInRange(lowerLimit int, upperLimit int) structure.StringArray
- func (s *StringArray) LengthLessThan(limit int) structure.StringArray
- func (s *StringArray) LengthLessThanOrEqualTo(limit int) structure.StringArray
- func (s *StringArray) LengthNotEqualTo(limit int) structure.StringArray
- func (s *StringArray) NotEmpty() structure.StringArray
- func (s *StringArray) NotExists() structure.StringArray
- func (s *StringArray) Using(usingFunc structure.StringArrayUsingFunc) structure.StringArray
- type Time
- func (t *Time) After(limit time.Time) structure.Time
- func (t *Time) AfterNow(threshold time.Duration) structure.Time
- func (t *Time) Before(limit time.Time) structure.Time
- func (t *Time) BeforeNow(threshold time.Duration) structure.Time
- func (t *Time) Exists() structure.Time
- func (t *Time) NotExists() structure.Time
- func (t *Time) NotZero() structure.Time
- func (t *Time) Using(usingFunc structure.TimeUsingFunc) structure.Time
- func (t *Time) Zero() structure.Time
- type ValidatableWithInt
- type ValidatableWithIntAdapter
- type ValidatableWithString
- type ValidatableWithStringAdapter
- type ValidatableWithStringArray
- type ValidatableWithStringArrayAdapter
- type Validator
- func (v *Validator) Array(reference string, value *[]interface{}) structure.Array
- func (v *Validator) Bool(reference string, value *bool) structure.Bool
- func (v *Validator) Error() error
- func (v *Validator) Float64(reference string, value *float64) structure.Float64
- func (v *Validator) HasError() bool
- func (v *Validator) HasMeta() bool
- func (v *Validator) HasSource() bool
- func (v *Validator) Int(reference string, value *int) structure.Int
- func (v *Validator) Meta() interface{}
- func (v *Validator) Object(reference string, value *map[string]interface{}) structure.Object
- func (v *Validator) Origin() structure.Origin
- func (v *Validator) ReportError(err error)
- func (v *Validator) Source() structure.Source
- func (v *Validator) String(reference string, value *string) structure.String
- func (v *Validator) StringArray(reference string, value *[]string) structure.StringArray
- func (v *Validator) Time(reference string, value *time.Time) structure.Time
- func (v *Validator) Validate(validatable structure.Validatable) error
- func (v *Validator) WithMeta(meta interface{}) structure.Validator
- func (v *Validator) WithOrigin(origin structure.Origin) structure.Validator
- func (v *Validator) WithReference(reference string) structure.Validator
- func (v *Validator) WithSource(source structure.Source) structure.Validator
Constants ¶
View Source
const ( ErrorCodeValueNotExists = "value-not-exists" ErrorCodeValueExists = "value-exists" ErrorCodeValueNotEmpty = "value-not-empty" ErrorCodeValueEmpty = "value-empty" ErrorCodeValueDuplicate = "value-duplicate" ErrorCodeValueNotTrue = "value-not-true" ErrorCodeValueNotFalse = "value-not-false" ErrorCodeValueOutOfRange = "value-out-of-range" ErrorCodeValueDisallowed = "value-disallowed" ErrorCodeValueNotAllowed = "value-not-allowed" ErrorCodeValueMatches = "value-matches" ErrorCodeValueNotMatches = "value-not-matches" ErrorCodeValueNotAfter = "value-not-after" ErrorCodeValueNotBefore = "value-not-before" ErrorCodeValueNotValid = "value-not-valid" ErrorCodeLengthOutOfRange = "length-out-of-range" )
Variables ¶
This section is empty.
Functions ¶
func ErrorLengthEqualTo ¶
func ErrorLengthNotEqualTo ¶
func ErrorLengthNotInRange ¶
func ErrorLengthNotLessThan ¶
func ErrorValueBooleanNotFalse ¶ added in v1.26.0
func ErrorValueBooleanNotFalse() error
func ErrorValueBooleanNotTrue ¶ added in v1.26.0
func ErrorValueBooleanNotTrue() error
func ErrorValueDuplicate ¶ added in v1.26.0
func ErrorValueDuplicate() error
func ErrorValueEmpty ¶
func ErrorValueEmpty() error
func ErrorValueEqualTo ¶
func ErrorValueEqualTo(value interface{}, limit interface{}) error
func ErrorValueExists ¶
func ErrorValueExists() error
func ErrorValueFloat64OneOf ¶
func ErrorValueIntNotOneOf ¶
func ErrorValueIntOneOf ¶
func ErrorValueNotEmpty ¶
func ErrorValueNotEmpty() error
func ErrorValueNotEqualTo ¶
func ErrorValueNotEqualTo(value interface{}, limit interface{}) error
func ErrorValueNotExists ¶
func ErrorValueNotExists() error
func ErrorValueNotGreaterThan ¶
func ErrorValueNotGreaterThan(value interface{}, limit interface{}) error
func ErrorValueNotGreaterThanOrEqualTo ¶
func ErrorValueNotGreaterThanOrEqualTo(value interface{}, limit interface{}) error
func ErrorValueNotInRange ¶
func ErrorValueNotInRange(value interface{}, lowerLimit interface{}, upperLimit interface{}) error
func ErrorValueNotLessThan ¶
func ErrorValueNotLessThan(value interface{}, limit interface{}) error
func ErrorValueNotLessThanOrEqualTo ¶
func ErrorValueNotLessThanOrEqualTo(value interface{}, limit interface{}) error
func ErrorValueStringAsTimeNotValid ¶ added in v1.24.0
func ErrorValueStringMatches ¶
func ErrorValueStringOneOf ¶
Types ¶
type Array ¶ added in v1.24.0
type Array struct {
// contains filtered or unexported fields
}
func NewArray ¶ added in v1.24.0
func NewArray(base *structureBase.Base, value *[]interface{}) *Array
type Float64 ¶
type Float64 struct {
// contains filtered or unexported fields
}
func NewFloat64 ¶
func NewFloat64(base *structureBase.Base, value *float64) *Float64
func (*Float64) GreaterThanOrEqualTo ¶
func (*Float64) LessThanOrEqualTo ¶
type Object ¶ added in v1.24.0
type Object struct {
// contains filtered or unexported fields
}
type String ¶
type String struct {
// contains filtered or unexported fields
}
func (*String) LengthGreaterThanOrEqualTo ¶
func (*String) LengthInRange ¶
func (*String) LengthLessThanOrEqualTo ¶
type StringArray ¶
type StringArray struct {
// contains filtered or unexported fields
}
func NewStringArray ¶
func NewStringArray(base *structureBase.Base, value *[]string) *StringArray
func (*StringArray) Each ¶ added in v1.26.0
func (s *StringArray) Each(eachFunc structure.StringEachFunc) structure.StringArray
func (*StringArray) EachMatches ¶
func (s *StringArray) EachMatches(expression *regexp.Regexp) structure.StringArray
func (*StringArray) EachNotEmpty ¶ added in v1.24.0
func (s *StringArray) EachNotEmpty() structure.StringArray
func (*StringArray) EachNotMatches ¶
func (s *StringArray) EachNotMatches(expression *regexp.Regexp) structure.StringArray
func (*StringArray) EachNotOneOf ¶
func (s *StringArray) EachNotOneOf(disallowedValues ...string) structure.StringArray
func (*StringArray) EachOneOf ¶
func (s *StringArray) EachOneOf(allowedValues ...string) structure.StringArray
func (*StringArray) EachUnique ¶ added in v1.26.0
func (s *StringArray) EachUnique() structure.StringArray
func (*StringArray) Empty ¶
func (s *StringArray) Empty() structure.StringArray
func (*StringArray) Exists ¶
func (s *StringArray) Exists() structure.StringArray
func (*StringArray) LengthEqualTo ¶
func (s *StringArray) LengthEqualTo(limit int) structure.StringArray
func (*StringArray) LengthGreaterThan ¶
func (s *StringArray) LengthGreaterThan(limit int) structure.StringArray
func (*StringArray) LengthGreaterThanOrEqualTo ¶
func (s *StringArray) LengthGreaterThanOrEqualTo(limit int) structure.StringArray
func (*StringArray) LengthInRange ¶
func (s *StringArray) LengthInRange(lowerLimit int, upperLimit int) structure.StringArray
func (*StringArray) LengthLessThan ¶
func (s *StringArray) LengthLessThan(limit int) structure.StringArray
func (*StringArray) LengthLessThanOrEqualTo ¶
func (s *StringArray) LengthLessThanOrEqualTo(limit int) structure.StringArray
func (*StringArray) LengthNotEqualTo ¶
func (s *StringArray) LengthNotEqualTo(limit int) structure.StringArray
func (*StringArray) NotEmpty ¶
func (s *StringArray) NotEmpty() structure.StringArray
func (*StringArray) NotExists ¶
func (s *StringArray) NotExists() structure.StringArray
func (*StringArray) Using ¶ added in v1.24.0
func (s *StringArray) Using(usingFunc structure.StringArrayUsingFunc) structure.StringArray
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
type ValidatableWithInt ¶ added in v1.26.0
type ValidatableWithIntAdapter ¶ added in v1.26.0
type ValidatableWithIntAdapter struct {
// contains filtered or unexported fields
}
func NewValidatableWithIntAdapter ¶ added in v1.26.0
func NewValidatableWithIntAdapter(validatableWithInt ValidatableWithInt, i *int) *ValidatableWithIntAdapter
func (*ValidatableWithIntAdapter) Validate ¶ added in v1.26.0
func (v *ValidatableWithIntAdapter) Validate(validator structure.Validator)
type ValidatableWithString ¶
type ValidatableWithStringAdapter ¶
type ValidatableWithStringAdapter struct {
// contains filtered or unexported fields
}
func NewValidatableWithStringAdapter ¶
func NewValidatableWithStringAdapter(validatableWithString ValidatableWithString, str *string) *ValidatableWithStringAdapter
func (*ValidatableWithStringAdapter) Validate ¶
func (v *ValidatableWithStringAdapter) Validate(validator structure.Validator)
type ValidatableWithStringArrayAdapter ¶
type ValidatableWithStringArrayAdapter struct {
// contains filtered or unexported fields
}
func NewValidatableWithStringArrayAdapter ¶
func NewValidatableWithStringArrayAdapter(validatableWithStringArray ValidatableWithStringArray, strArray *[]string) *ValidatableWithStringArrayAdapter
func (*ValidatableWithStringArrayAdapter) Validate ¶
func (v *ValidatableWithStringArrayAdapter) Validate(validator structure.Validator)
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
func NewValidator ¶
func NewValidator(base *structureBase.Base) *Validator
func (*Validator) ReportError ¶ added in v1.24.0
func (*Validator) StringArray ¶
func (v *Validator) StringArray(reference string, value *[]string) structure.StringArray
func (*Validator) WithOrigin ¶ added in v1.24.0
func (*Validator) WithReference ¶
Click to show internal directories.
Click to hide internal directories.