structure

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: BSD-2-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

func ForgivingTimeString added in v1.32.2

func ForgivingTimeString(stringValue string) (forgivingTime string)

ForgivingTimeString is a helper function added specifically to handle https://tidepool.atlassian.net/browse/BACK-1161 It should be deprecated once Dexcom fixes their API.

Types

type Array added in v1.24.0

type Array interface {
	Exists() Array
	NotExists() Array

	Empty() Array
	NotEmpty() Array

	Using(usingFunc ArrayUsingFunc) Array
}

type ArrayParsable

type ArrayParsable interface {
	Parse(parser ArrayParser)
}

type ArrayParser

type ArrayParser interface {
	OriginReporter
	SourceReporter
	MetaReporter

	ErrorReporter

	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

	WithOrigin(origin Origin) ArrayParser
	WithSource(source Source) ArrayParser
	WithMeta(meta interface{}) ArrayParser
	WithReferenceObjectParser(reference int) ObjectParser
	WithReferenceArrayParser(reference int) ArrayParser
	WithReferenceErrorReporter(reference int) ErrorReporter
}

type ArrayUsingFunc added in v1.26.0

type ArrayUsingFunc func(value []interface{}, errorReporter ErrorReporter)

type Bool

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

	True() Bool
	False() Bool

	Using(usingFunc BoolUsingFunc) Bool
}

type BoolUsingFunc added in v1.26.0

type BoolUsingFunc func(value bool, errorReporter ErrorReporter)

type ErrorReporter added in v1.24.0

type ErrorReporter interface {
	HasError() bool
	Error() error
	ReportError(err error)
}

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

	Using(usingFunc Float64UsingFunc) Float64
}

type Float64UsingFunc added in v1.26.0

type Float64UsingFunc func(value float64, errorReporter ErrorReporter)

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

	Using(usingFunc IntUsingFunc) Int
}

type IntUsingFunc added in v1.26.0

type IntUsingFunc func(value int, errorReporter ErrorReporter)

type MetaReporter added in v1.24.0

type MetaReporter interface {
	HasMeta() bool
	Meta() interface{}
}

type Normalizable

type Normalizable interface {
	Normalize(normalizer Normalizer)
}

type Normalizer

type Normalizer interface {
	OriginReporter
	SourceReporter
	MetaReporter

	ErrorReporter

	Normalize(normalizable Normalizable) error

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

type Object added in v1.24.0

type Object interface {
	Exists() Object
	NotExists() Object

	Empty() Object
	NotEmpty() Object

	Using(usingFunc ObjectUsingFunc) Object
}

type ObjectParsable

type ObjectParsable interface {
	Parse(parser ObjectParser)
}

type ObjectParser

type ObjectParser interface {
	OriginReporter
	SourceReporter
	MetaReporter

	ErrorReporter

	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
	ForgivingTime(reference string, layout string) *time.Time

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

	Interface(reference string) *interface{}

	NotParsed() error

	WithOrigin(origin Origin) ObjectParser
	WithSource(source Source) ObjectParser
	WithMeta(meta interface{}) ObjectParser
	WithReferenceObjectParser(reference string) ObjectParser
	WithReferenceArrayParser(reference string) ArrayParser
	WithReferenceErrorReporter(reference string) ErrorReporter
}

type ObjectUsingFunc added in v1.26.0

type ObjectUsingFunc func(value map[string]interface{}, errorReporter ErrorReporter)

type Origin added in v1.24.0

type Origin int
const (
	OriginStore Origin = iota
	OriginInternal
	OriginExternal
)

func Origins added in v1.24.0

func Origins() []Origin

type OriginReporter added in v1.24.0

type OriginReporter interface {
	Origin() Origin
}

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 SourceReporter added in v1.24.0

type SourceReporter interface {
	HasSource() bool
	Source() 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

	Using(usingFunc StringUsingFunc) String

	AsTime(layout string) Time
}

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

	Each(eachFunc StringArrayEachFunc) StringArray

	EachNotEmpty() StringArray

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

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

	EachUsing(eachUsingFunc StringArrayEachUsingFunc) StringArray

	EachUnique() StringArray

	Using(usingFunc StringArrayUsingFunc) StringArray
}

type StringArrayEachFunc added in v1.29.0

type StringArrayEachFunc func(stringValidator String)

type StringArrayEachUsingFunc added in v1.29.0

type StringArrayEachUsingFunc func(value string, errorReporter ErrorReporter)

type StringArrayUsingFunc added in v1.26.0

type StringArrayUsingFunc func(value []string, errorReporter ErrorReporter)

type StringUsingFunc added in v1.26.0

type StringUsingFunc func(value string, errorReporter ErrorReporter)

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

	Using(usingFunc TimeUsingFunc) Time
}

type TimeUsingFunc added in v1.26.0

type TimeUsingFunc func(value time.Time, errorReporter ErrorReporter)

type Validatable

type Validatable interface {
	Validate(validator Validator)
}

type Validator

type Validator interface {
	OriginReporter
	SourceReporter
	MetaReporter

	ErrorReporter

	Validate(validatable Validatable) error

	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

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

	WithOrigin(origin Origin) Validator
	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