specification

package
v0.0.0-...-c864ae1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: BSD-2-Clause, BSD-3-Clause, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBoolean

func IsBoolean(key string, value interface{}) error

func IsDecimal

func IsDecimal(key string, value interface{}) error

func IsDecimalBetweenZeroAndOne

func IsDecimalBetweenZeroAndOne(key string, value interface{}) error

func IsDecimalWithInclusiveBounds

func IsDecimalWithInclusiveBounds(key string, value interface{}, minValue float64, maxValue float64) error

func IsInteger

func IsInteger(key string, value interface{}) error

func IsIntegerWithInclusiveBounds

func IsIntegerWithInclusiveBounds(key string, value interface{}, minValue int64, maxValue int64) error

func IsNonNegativeDecimal

func IsNonNegativeDecimal(key string, value interface{}) error

func IsNonNegativeInteger

func IsNonNegativeInteger(key string, value interface{}) error

func IsReadableFile

func IsReadableFile(key string, value interface{}) error

func IsString

func IsString(key string, value interface{}) error

Types

type MissingSpecificationError

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

func NewSpecificationMissingError

func NewSpecificationMissingError(key string) *MissingSpecificationError

func (*MissingSpecificationError) Error

func (m *MissingSpecificationError) Error() string

func (*MissingSpecificationError) IsValid

func (m *MissingSpecificationError) IsValid() bool

type SpecValidator

type SpecValidator func(key string, value interface{}) error

type Specification

type Specification struct {
	Key          string
	Validator    SpecValidator
	DefaultValue interface{}
	IsOptional   bool
}

type Specifications

type Specifications map[string]Specification

func NewSpecifications

func NewSpecifications() *Specifications

func (Specifications) Add

func (Specifications) HasEntry

func (s Specifications) HasEntry(key string) bool

func (Specifications) Keys

func (s Specifications) Keys() []string

func (Specifications) Validate

func (s Specifications) Validate(key string, value interface{}) error

type ValidSpecificationError

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

func NewInvalidSpecificationError

func NewInvalidSpecificationError(message string) *ValidSpecificationError

func NewValidSpecificationError

func NewValidSpecificationError(key string, value interface{}) *ValidSpecificationError

func (*ValidSpecificationError) Error

func (m *ValidSpecificationError) Error() string

func (*ValidSpecificationError) IsValid

func (m *ValidSpecificationError) IsValid() bool

type ValidationError

type ValidationError interface {
	error
	IsValid() bool
}

Jump to

Keyboard shortcuts

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