Documentation
¶
Overview ¶
Package for declaring and executing validations which can be techninal validations, bussiness validations, struct validations
Index ¶
- type Context
- type DefaultValidation
- type Validation
- type ValidationFunc
- func MaxFloat32(limit, value float32, name string) ValidationFunc
- func MaxFloat64(limit, value float32, name string) ValidationFunc
- func MaxInt(limit, value int, name string) ValidationFunc
- func MaxInt64(limit, value int64, name string) ValidationFunc
- func MaxLength(length int, value, name string) ValidationFunc
- func Message(f ValidationFunc, message string) ValidationFunc
- func MinFloat32(limit, value float32, name string) ValidationFunc
- func MinFloat64(limit, value float32, name string) ValidationFunc
- func MinInt(limit, value int, name string) ValidationFunc
- func MinInt64(limit, value int64, name string) ValidationFunc
- func MinLength(length int, value, name string) ValidationFunc
- func Required(value interface{}, name string) ValidationFunc
- type Validator
- type VldErrors
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
Err error
}
Passes data between validations. Used for error passing at the moment.
type DefaultValidation ¶
type DefaultValidation struct { }
Default struct which you can embed into your struct that implements ValidateOverride method. In that way you only must implement Validate method
func (DefaultValidation) ValidateOverride ¶
func (f DefaultValidation) ValidateOverride(ctx Context) Context
type Validation ¶
Every type which wants to act as validation must implement this interface
type ValidationFunc ¶
type ValidationFunc func() error
Type that holds validation func which implements Validation interface
func Message ¶
func Message(f ValidationFunc, message string) ValidationFunc
func (ValidationFunc) Validate ¶
func (f ValidationFunc) Validate(ctx Context) Context
func (ValidationFunc) ValidateOverride ¶
func (f ValidationFunc) ValidateOverride(ctx Context) Context
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Holds and runs validations
func (*Validator) Add ¶
func (t *Validator) Add(v Validation) *Validator
Adds validation to validator
func (*Validator) ValidateAll ¶
Validates all validations and collects errors
func (*Validator) Validations ¶
func (t *Validator) Validations(v Validation) []Validation
Returns validations on this validator
Click to show internal directories.
Click to hide internal directories.