Documentation ¶
Index ¶
- Variables
- func RegisterValidator(name string, cb ValidatorCallback) error
- type Config
- func (c *Config) Bool(name string, idx int, opts ...Option) (bool, error)
- func (c *Config) Child(name string, idx int, opts ...Option) (*Config, error)
- func (c *Config) CountField(name string, opts ...Option) (int, error)
- func (c *Config) Float(name string, idx int, opts ...Option) (float64, error)
- func (c *Config) GetFields() []string
- func (c *Config) HasField(name string) bool
- func (c *Config) Int(name string, idx int, opts ...Option) (int64, error)
- func (c *Config) IsArray() bool
- func (c *Config) IsDict() bool
- func (c *Config) Merge(from interface{}, options ...Option) error
- func (c *Config) Parent() *Config
- func (c *Config) Path(sep string) string
- func (c *Config) PathOf(field, sep string) string
- func (c *Config) SetBool(name string, idx int, value bool, opts ...Option) error
- func (c *Config) SetChild(name string, idx int, value *Config, opts ...Option) error
- func (c *Config) SetFloat(name string, idx int, value float64, opts ...Option) error
- func (c *Config) SetInt(name string, idx int, value int64, opts ...Option) error
- func (c *Config) SetString(name string, idx int, value string, opts ...Option) error
- func (c *Config) SetUint(name string, idx int, value uint64, opts ...Option) error
- func (c *Config) String(name string, idx int, opts ...Option) (string, error)
- func (c *Config) Uint(name string, idx int, opts ...Option) (uint64, error)
- func (c *Config) Unpack(to interface{}, options ...Option) error
- type Error
- type Meta
- type Option
- type Unpacker
- type Validator
- type ValidatorCallback
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissing = errors.New("missing field") ErrDuplicateValidator = errors.New("validator already registered") ErrTypeNoArray = errors.New("field is no array") ErrTypeMismatch = errors.New("type mismatch") ErrKeyTypeNotString = errors.New("key must be a string") ErrIndexOutOfRange = errors.New("out of range index") ErrPointerRequired = errors.New("pointer required for unpacking configurations") ErrArraySizeMistach = errors.New("Array size mismatch") ErrExpectedObject = errors.New("expected object") ErrNilConfig = errors.New("config is nil") ErrNilValue = errors.New("nil value is invalid") ErrTODO = errors.New("TODO - implement me") ErrDuplicateKeey = errors.New("duplicate key") ErrOverflow = errors.New("integer overflow") ErrNegative = errors.New("negative value") ErrZeroValue = errors.New("zero value") ErrRequired = errors.New("missing required field") ErrEmpty = errors.New("empty field") )
error Reasons
View Source
var ( ErrConfig = errors.New("Configuration error") ErrImplementation = errors.New("Implementation error") ErrUnknown = errors.New("Unspecified") )
error classes
View Source
var ResolveEnv = Resolve(func(name string) (string, error) { value := os.Getenv(name) if value == "" { return "", ErrMissing } return value, nil })
Functions ¶
func RegisterValidator ¶ added in v0.3.0
func RegisterValidator(name string, cb ValidatorCallback) error
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func (*Config) CountField ¶
number of elements for this field. If config value is a list, returns number of elements in list
type Meta ¶ added in v0.3.0
type Meta struct {
Source string
}
Meta holds additional meta data per config value
type ValidatorCallback ¶ added in v0.3.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.