validator

package
v1.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2018 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorCodeValueNotExists   = "value-not-exists"
	ErrorCodeValueExists      = "value-exists"
	ErrorCodeValueNotEmpty    = "value-not-empty"
	ErrorCodeValueEmpty       = "value-empty"
	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"
	ErrorCodeValueZero        = "value-zero"
	ErrorCodeValueNotZero     = "value-not-zero"
	ErrorCodeValueNotAfter    = "value-not-after"
	ErrorCodeValueNotBefore   = "value-not-before"
	ErrorCodeLengthOutOfRange = "length-out-of-range"
)

Variables

This section is empty.

Functions

func ErrorLengthEqualTo

func ErrorLengthEqualTo(length int, limit int) error

func ErrorLengthNotEqualTo

func ErrorLengthNotEqualTo(length int, limit int) error

func ErrorLengthNotGreaterThan

func ErrorLengthNotGreaterThan(length int, limit int) error

func ErrorLengthNotGreaterThanOrEqualTo

func ErrorLengthNotGreaterThanOrEqualTo(length int, limit int) error

func ErrorLengthNotInRange

func ErrorLengthNotInRange(length int, lowerLimit int, upperLimit int) error

func ErrorLengthNotLessThan

func ErrorLengthNotLessThan(length int, limit int) error

func ErrorLengthNotLessThanOrEqualTo

func ErrorLengthNotLessThanOrEqualTo(length int, limit int) error

func ErrorValueEmpty

func ErrorValueEmpty() error

func ErrorValueEqualTo

func ErrorValueEqualTo(value interface{}, limit interface{}) error

func ErrorValueExists

func ErrorValueExists() error

func ErrorValueFloat64NotOneOf

func ErrorValueFloat64NotOneOf(value float64, allowedValues []float64) error

func ErrorValueFloat64OneOf

func ErrorValueFloat64OneOf(value float64, disallowedValues []float64) error

func ErrorValueIntNotOneOf

func ErrorValueIntNotOneOf(value int, allowedValues []int) error

func ErrorValueIntOneOf

func ErrorValueIntOneOf(value int, disallowedValues []int) error

func ErrorValueNotEmpty

func ErrorValueNotEmpty() error

func ErrorValueNotEqualTo

func ErrorValueNotEqualTo(value interface{}, limit interface{}) error

func ErrorValueNotExists

func ErrorValueNotExists() error

func ErrorValueNotFalse

func ErrorValueNotFalse() 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 ErrorValueNotTrue

func ErrorValueNotTrue() error

func ErrorValueStringMatches

func ErrorValueStringMatches(value string, expression *regexp.Regexp) error

func ErrorValueStringNotMatches

func ErrorValueStringNotMatches(value string, expression *regexp.Regexp) error

func ErrorValueStringNotOneOf

func ErrorValueStringNotOneOf(value string, allowedValues []string) error

func ErrorValueStringOneOf

func ErrorValueStringOneOf(value string, disallowedValues []string) error

func ErrorValueTimeNotAfter

func ErrorValueTimeNotAfter(value time.Time, limit time.Time) error

func ErrorValueTimeNotAfterNow

func ErrorValueTimeNotAfterNow(value time.Time) error

func ErrorValueTimeNotBefore

func ErrorValueTimeNotBefore(value time.Time, limit time.Time) error

func ErrorValueTimeNotBeforeNow

func ErrorValueTimeNotBeforeNow(value time.Time) error

func ErrorValueTimeNotZero

func ErrorValueTimeNotZero(value time.Time) error

func ErrorValueTimeZero

func ErrorValueTimeZero(value time.Time) error

func ExpressionAsString

func ExpressionAsString(expression *regexp.Regexp) string

func QuoteIfString

func QuoteIfString(interfaceValue interface{}) interface{}

Types

type Bool

type Bool struct {
	// contains filtered or unexported fields
}

func NewBool

func NewBool(base *structureBase.Base, value *bool) *Bool

func (*Bool) Exists

func (b *Bool) Exists() structure.Bool

func (*Bool) False

func (b *Bool) False() structure.Bool

func (*Bool) NotExists

func (b *Bool) NotExists() structure.Bool

func (*Bool) True

func (b *Bool) True() structure.Bool

type Float64

type Float64 struct {
	// contains filtered or unexported fields
}

func NewFloat64

func NewFloat64(base *structureBase.Base, value *float64) *Float64

func (*Float64) EqualTo

func (f *Float64) EqualTo(value float64) structure.Float64

func (*Float64) Exists

func (f *Float64) Exists() structure.Float64

func (*Float64) GreaterThan

func (f *Float64) GreaterThan(limit float64) structure.Float64

func (*Float64) GreaterThanOrEqualTo

func (f *Float64) GreaterThanOrEqualTo(limit float64) structure.Float64

func (*Float64) InRange

func (f *Float64) InRange(lowerLimit float64, upperLimit float64) structure.Float64

func (*Float64) LessThan

func (f *Float64) LessThan(limit float64) structure.Float64

func (*Float64) LessThanOrEqualTo

func (f *Float64) LessThanOrEqualTo(limit float64) structure.Float64

func (*Float64) NotEqualTo

func (f *Float64) NotEqualTo(value float64) structure.Float64

func (*Float64) NotExists

func (f *Float64) NotExists() structure.Float64

func (*Float64) NotOneOf

func (f *Float64) NotOneOf(disallowedValues ...float64) structure.Float64

func (*Float64) OneOf

func (f *Float64) OneOf(allowedValues ...float64) structure.Float64

type Int

type Int struct {
	// contains filtered or unexported fields
}

func NewInt

func NewInt(base *structureBase.Base, value *int) *Int

func (*Int) EqualTo

func (i *Int) EqualTo(value int) structure.Int

func (*Int) Exists

func (i *Int) Exists() structure.Int

func (*Int) GreaterThan

func (i *Int) GreaterThan(limit int) structure.Int

func (*Int) GreaterThanOrEqualTo

func (i *Int) GreaterThanOrEqualTo(limit int) structure.Int

func (*Int) InRange

func (i *Int) InRange(lowerLimit int, upperLimit int) structure.Int

func (*Int) LessThan

func (i *Int) LessThan(limit int) structure.Int

func (*Int) LessThanOrEqualTo

func (i *Int) LessThanOrEqualTo(limit int) structure.Int

func (*Int) NotEqualTo

func (i *Int) NotEqualTo(value int) structure.Int

func (*Int) NotExists

func (i *Int) NotExists() structure.Int

func (*Int) NotOneOf

func (i *Int) NotOneOf(disallowedValues ...int) structure.Int

func (*Int) OneOf

func (i *Int) OneOf(allowedValues ...int) structure.Int

type String

type String struct {
	// contains filtered or unexported fields
}

func NewString

func NewString(base *structureBase.Base, value *string) *String

func (*String) Empty

func (s *String) Empty() structure.String

func (*String) EqualTo

func (s *String) EqualTo(value string) structure.String

func (*String) Exists

func (s *String) Exists() structure.String

func (*String) LengthEqualTo

func (s *String) LengthEqualTo(limit int) structure.String

func (*String) LengthGreaterThan

func (s *String) LengthGreaterThan(limit int) structure.String

func (*String) LengthGreaterThanOrEqualTo

func (s *String) LengthGreaterThanOrEqualTo(limit int) structure.String

func (*String) LengthInRange

func (s *String) LengthInRange(lowerLimit int, upperLimit int) structure.String

func (*String) LengthLessThan

func (s *String) LengthLessThan(limit int) structure.String

func (*String) LengthLessThanOrEqualTo

func (s *String) LengthLessThanOrEqualTo(limit int) structure.String

func (*String) LengthNotEqualTo

func (s *String) LengthNotEqualTo(limit int) structure.String

func (*String) Matches

func (s *String) Matches(expression *regexp.Regexp) structure.String

func (*String) NotEmpty

func (s *String) NotEmpty() structure.String

func (*String) NotEqualTo

func (s *String) NotEqualTo(value string) structure.String

func (*String) NotExists

func (s *String) NotExists() structure.String

func (*String) NotMatches

func (s *String) NotMatches(expression *regexp.Regexp) structure.String

func (*String) NotOneOf

func (s *String) NotOneOf(disallowedValues ...string) structure.String

func (*String) OneOf

func (s *String) OneOf(allowedValues ...string) structure.String

type StringArray

type StringArray struct {
	// contains filtered or unexported fields
}

func NewStringArray

func NewStringArray(base *structureBase.Base, value *[]string) *StringArray

func (*StringArray) EachMatches

func (s *StringArray) EachMatches(expression *regexp.Regexp) 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) 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

type Time

type Time struct {
	// contains filtered or unexported fields
}

func NewTime

func NewTime(base *structureBase.Base, value *time.Time) *Time

func (*Time) After

func (t *Time) After(limit time.Time) structure.Time

func (*Time) AfterNow

func (t *Time) AfterNow(threshold time.Duration) structure.Time

func (*Time) Before

func (t *Time) Before(limit time.Time) structure.Time

func (*Time) BeforeNow

func (t *Time) BeforeNow(threshold time.Duration) structure.Time

func (*Time) Exists

func (t *Time) Exists() structure.Time

func (*Time) NotExists

func (t *Time) NotExists() structure.Time

func (*Time) NotZero

func (t *Time) NotZero() structure.Time

func (*Time) Zero

func (t *Time) Zero() structure.Time

type ValidatableWithString

type ValidatableWithString interface {
	Validate(validator structure.Validator, str *string)
}

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 ValidatableWithStringArray

type ValidatableWithStringArray interface {
	Validate(validator structure.Validator, strArray *[]string)
}

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 Validating

type Validating struct {
	// contains filtered or unexported fields
}

func NewValidating

func NewValidating(base *structureBase.Base, value structure.Validatable) *Validating

func (*Validating) Exists

func (v *Validating) Exists() structure.Validating

func (*Validating) NotExists

func (v *Validating) NotExists() structure.Validating

func (*Validating) Validate

func (v *Validating) Validate() structure.Validating

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

func New

func New() *Validator

func NewValidator

func NewValidator(base *structureBase.Base) *Validator

func (*Validator) Bool

func (v *Validator) Bool(reference string, value *bool) structure.Bool

func (*Validator) Error

func (v *Validator) Error() error

func (*Validator) Float64

func (v *Validator) Float64(reference string, value *float64) structure.Float64

func (*Validator) Int

func (v *Validator) Int(reference string, value *int) structure.Int

func (*Validator) String

func (v *Validator) String(reference string, value *string) structure.String

func (*Validator) StringArray

func (v *Validator) StringArray(reference string, value *[]string) structure.StringArray

func (*Validator) Time

func (v *Validator) Time(reference string, value *time.Time) structure.Time

func (*Validator) Validate

func (v *Validator) Validate(validatable structure.Validatable) error

func (*Validator) Validating

func (v *Validator) Validating(reference string, value structure.Validatable) structure.Validating

func (*Validator) WithMeta

func (v *Validator) WithMeta(meta interface{}) structure.Validator

func (*Validator) WithReference

func (v *Validator) WithReference(reference string) structure.Validator

func (*Validator) WithSource

func (v *Validator) WithSource(source structure.Source) structure.Validator

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL