structure

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2017 License: BSD-3-Clause Imports: 3 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodePointerReference

func EncodePointerReference(reference string) string

Types

type ArrayParsable

type ArrayParsable interface {
	Parse(parser ArrayParser)
}

type ArrayParser

type ArrayParser interface {
	Error() error

	Exists() bool

	Parse(arrayParsable ArrayParsable) error

	References() []int
	ReferenceExists(reference int) bool

	Bool(reference int) *bool
	Float64(reference int) *float64
	Int(reference int) *int
	String(reference int) *string
	StringArray(reference int) *[]string
	Time(reference int, layout string) *time.Time

	Object(reference int) *map[string]interface{}
	Array(reference int) *[]interface{}

	Interface(reference int) *interface{}

	NotParsed() error

	WithSource(source Source) ArrayParser
	WithMeta(meta interface{}) ArrayParser
	WithReferenceObjectParser(reference int) ObjectParser
	WithReferenceArrayParser(reference int) ArrayParser
}

type Bool

type Bool interface {
	Exists() Bool
	NotExists() Bool

	True() Bool
	False() Bool
}

type Float64

type Float64 interface {
	Exists() Float64
	NotExists() Float64

	EqualTo(value float64) Float64
	NotEqualTo(value float64) Float64

	LessThan(limit float64) Float64
	LessThanOrEqualTo(limit float64) Float64
	GreaterThan(limit float64) Float64
	GreaterThanOrEqualTo(limit float64) Float64
	InRange(lowerLimit float64, upperLimit float64) Float64

	OneOf(allowedValues ...float64) Float64
	NotOneOf(disallowedValues ...float64) Float64
}

type Int

type Int interface {
	Exists() Int
	NotExists() Int

	EqualTo(value int) Int
	NotEqualTo(value int) Int

	LessThan(limit int) Int
	LessThanOrEqualTo(limit int) Int
	GreaterThan(limit int) Int
	GreaterThanOrEqualTo(limit int) Int
	InRange(lowerLimit int, upperLimit int) Int

	OneOf(allowedValues ...int) Int
	NotOneOf(disallowedValues ...int) Int
}

type Normalizable

type Normalizable interface {
	Normalize(normalizer Normalizer)
}

type Normalizer

type Normalizer interface {
	Error() error

	Normalize(normalizable Normalizable) error

	WithSource(source Source) Normalizer
	WithMeta(meta interface{}) Normalizer
	WithReference(reference string) Normalizer
}

type ObjectParsable

type ObjectParsable interface {
	Parse(parser ObjectParser)
}

type ObjectParser

type ObjectParser interface {
	Error() error

	Exists() bool

	Parse(objectParsable ObjectParsable) error

	References() []string
	ReferenceExists(reference string) bool

	Bool(reference string) *bool
	Float64(reference string) *float64
	Int(reference string) *int
	String(reference string) *string
	StringArray(reference string) *[]string
	Time(reference string, layout string) *time.Time

	Object(reference string) *map[string]interface{}
	Array(reference string) *[]interface{}

	Interface(reference string) *interface{}

	NotParsed() error

	WithSource(source Source) ObjectParser
	WithMeta(meta interface{}) ObjectParser
	WithReferenceObjectParser(reference string) ObjectParser
	WithReferenceArrayParser(reference string) ArrayParser
}

type ParameterSource

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

func NewParameterSource

func NewParameterSource() *ParameterSource

func (*ParameterSource) Parameter

func (p *ParameterSource) Parameter() string

func (*ParameterSource) Pointer

func (p *ParameterSource) Pointer() string

func (*ParameterSource) WithReference

func (p *ParameterSource) WithReference(reference string) Source

type PointerSource

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

func NewPointerSource

func NewPointerSource() *PointerSource

func (*PointerSource) Parameter

func (p *PointerSource) Parameter() string

func (*PointerSource) Pointer

func (p *PointerSource) Pointer() string

func (*PointerSource) WithReference

func (p *PointerSource) WithReference(reference string) Source

type Source

type Source interface {
	Parameter() string
	Pointer() string

	WithReference(reference string) Source
}

type String

type String interface {
	Exists() String
	NotExists() String

	Empty() String
	NotEmpty() String

	EqualTo(value string) String
	NotEqualTo(value string) String

	LengthEqualTo(limit int) String
	LengthNotEqualTo(limit int) String
	LengthLessThan(limit int) String
	LengthLessThanOrEqualTo(limit int) String
	LengthGreaterThan(limit int) String
	LengthGreaterThanOrEqualTo(limit int) String
	LengthInRange(lowerLimit int, upperLimit int) String

	OneOf(allowedValues ...string) String
	NotOneOf(disallowedValues ...string) String

	Matches(expression *regexp.Regexp) String
	NotMatches(expression *regexp.Regexp) String
}

type StringArray

type StringArray interface {
	Exists() StringArray
	NotExists() StringArray

	Empty() StringArray
	NotEmpty() StringArray

	LengthEqualTo(limit int) StringArray
	LengthNotEqualTo(limit int) StringArray
	LengthLessThan(limit int) StringArray
	LengthLessThanOrEqualTo(limit int) StringArray
	LengthGreaterThan(limit int) StringArray
	LengthGreaterThanOrEqualTo(limit int) StringArray
	LengthInRange(lowerLimit int, upperLimit int) StringArray

	EachOneOf(allowedValues ...string) StringArray
	EachNotOneOf(disallowedValues ...string) StringArray

	EachMatches(expression *regexp.Regexp) StringArray
	EachNotMatches(expression *regexp.Regexp) StringArray
}

type Time

type Time interface {
	Exists() Time
	NotExists() Time

	Zero() Time
	NotZero() Time

	After(limit time.Time) Time
	AfterNow(threshold time.Duration) Time
	Before(limit time.Time) Time
	BeforeNow(threshold time.Duration) Time
}

type Validatable

type Validatable interface {
	Validate(validator Validator)
}

type Validating

type Validating interface {
	Exists() Validating
	NotExists() Validating

	Validate() Validating
}

type Validator

type Validator interface {
	Error() error

	Validate(validatable Validatable) error

	Validating(reference string, validatable Validatable) Validating

	Bool(reference string, value *bool) Bool
	Float64(reference string, value *float64) Float64
	Int(reference string, value *int) Int
	String(reference string, value *string) String
	StringArray(reference string, value *[]string) StringArray
	Time(reference string, value *time.Time) Time

	WithSource(source Source) Validator
	WithMeta(meta interface{}) Validator
	WithReference(reference string) Validator
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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