Documentation ¶
Overview ¶
Package gomap implements utilities to manipulate generic maps and cast elements into native Go types and native Go structures
The package is really simple to use
Index ¶
- type Element
- func (elt *Element) Bool(defaultValue ...bool) (bool, error)
- func (elt *Element) BoolSlice(defaultValue ...[]bool) ([]bool, error)
- func (elt *Element) Float32(defaultValue ...float32) (float32, error)
- func (elt *Element) Float32Slice(defaultValue ...[]float32) ([]float32, error)
- func (elt *Element) Float64(defaultValue ...float64) (float64, error)
- func (elt *Element) Float64Slice(defaultValue ...[]float64) ([]float64, error)
- func (elt *Element) Get(path ...string) *Element
- func (elt *Element) Int(defaultValue ...int) (int, error)
- func (elt *Element) Int16(defaultValue ...int16) (int16, error)
- func (elt *Element) Int16Slice(defaultValue ...[]int16) ([]int16, error)
- func (elt *Element) Int32(defaultValue ...int32) (int32, error)
- func (elt *Element) Int32Slice(defaultValue ...[]int32) ([]int32, error)
- func (elt *Element) Int64(defaultValue ...int64) (int64, error)
- func (elt *Element) Int64Slice(defaultValue ...[]int64) ([]int64, error)
- func (elt *Element) Int8(defaultValue ...int8) (int8, error)
- func (elt *Element) Int8Slice(defaultValue ...[]int8) ([]int8, error)
- func (elt *Element) IntSlice(defaultValue ...[]int) ([]int, error)
- func (elt *Element) Object(obj interface{}) error
- func (elt *Element) String(defaultValue ...string) (string, error)
- func (elt *Element) StringSlice(defaultValue ...[]string) ([]string, error)
- func (elt *Element) Uint16(defaultValue ...uint16) (uint16, error)
- func (elt *Element) Uint16Slice(defaultValue ...[]uint16) ([]uint16, error)
- func (elt *Element) Uint32(defaultValue ...uint32) (uint32, error)
- func (elt *Element) Uint32Slice(defaultValue ...[]uint32) ([]uint32, error)
- func (elt *Element) Uint64(defaultValue ...uint64) (uint64, error)
- func (elt *Element) Uint64Slice(defaultValue ...[]uint64) ([]uint64, error)
- func (elt *Element) Uint8(defaultValue ...uint8) (uint8, error)
- func (elt *Element) Uint8Slice(defaultValue ...[]uint8) ([]uint8, error)
- type GMap
- type GSlice
- type WrongPathError
- type WrongTypeError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Element ¶
type Element struct { Path []string Value interface{} }
Element an element of the map
func (*Element) Float32Slice ¶
Float32Slice cast element value into float32
func (*Element) Float64Slice ¶
Float64Slice cast element value into float64
func (*Element) Int16Slice ¶
Int16Slice cast element value into int16
func (*Element) Int32Slice ¶
Int32Slice cast element value into int32
func (*Element) Int64Slice ¶
Int64Slice cast element value into int64
func (*Element) StringSlice ¶
StringSlice cast element value into string
func (*Element) Uint16Slice ¶
Uint16Slice cast element value into uint16
func (*Element) Uint32Slice ¶
Uint32Slice cast element value into uint32
func (*Element) Uint64Slice ¶
Uint64Slice cast element value into uint64
type GMap ¶
type GMap map[string]interface{}
GMap overload map with utility functions
type WrongPathError ¶
type WrongPathError struct {
// contains filtered or unexported fields
}
WrongPathError raised when the path is not correct
func NewWrongPathError ¶
func NewWrongPathError(path []string) *WrongPathError
NewWrongPathError creates a new WrongPathError
func (*WrongPathError) Error ¶
func (e *WrongPathError) Error() string
type WrongTypeError ¶
type WrongTypeError struct {
// contains filtered or unexported fields
}
WrongTypeError raised when the path is not correct
func NewWrongTypeError ¶
func NewWrongTypeError(expected string, value interface{}) *WrongTypeError
NewWrongTypeError creates a new WrongPathError
func (*WrongTypeError) Error ¶
func (e *WrongTypeError) Error() string