Documentation
¶
Index ¶
- Variables
- func AppendToSlice(out interface{}, values ...interface{}) error
- func NewCollectionValueInstance(collection interface{}) (interface{}, error)
- func NewInstance(value interface{}) interface{}
- func SetMapValue(out interface{}, key interface{}, value interface{}) error
- func SetValue(out interface{}, value interface{}) (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotPointer is returned when a function receives a parameter that is not a pointer. ErrNotPointer = errors.New("out value is not pointer") // ErrNotCollection is returned when a function receives a parameter that is not a collection. ErrNotCollection = errors.New("out value is not collection") // ErrInvalidOutValue is returned when an out value cannot be set to the target value. ErrInvalidOutValue = errors.New("invalid out value type") )
Functions ¶
func AppendToSlice ¶
func AppendToSlice(out interface{}, values ...interface{}) error
AppendToSlice appends values to a slice. `out` must be a pointer to a slice. `values` must be compatible with the slice type.
func NewCollectionValueInstance ¶
func NewCollectionValueInstance(collection interface{}) (interface{}, error)
NewCollectionValueInstance receives a collection (slice, map) and returns a new instance of the collection's value type. If the collection value type is a pointer type, a pointer object to a new instance of the type value is returned.
func NewInstance ¶
func NewInstance(value interface{}) interface{}
NewInstance returns a new instance of the same type as the input value. The returned value will contain the zero value of the type.
func SetMapValue ¶
func SetMapValue(out interface{}, key interface{}, value interface{}) error
SetMapValue sets a value in a map. `out` must be a map. `key` must be compatible with the map key type. `value` must be compatible with the map value type.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.