Documentation
¶
Overview ¶
Package i2s provides convertor from raw data representation as map[string]interface{} into external structure using reflection. It can also convert []map[string]interface{} or []interface{} into slice of structures.
Designed to be used inside config package with data unmarshalled by json, yaml, toml or any other such encoders.
It provides singleton Convertor instance that must be obtained with Instance function.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrMismatchedTypes error is returned when types of input and output fields doesn't match. ErrMismatchedTypes = errors.New("mismatched types") // ErrMapKeyNotString error is returned when some map has keys with type different from string. ErrMapKeyNotString = errors.New("map keys must be strings") // ErrOutputNotPointer error is returned when provided output parameter is not a pointer. ErrOutputNotPointer = errors.New("output must be a pointer") // ErrUnknownField error is returned when output structure doesn't have an appropriate field for input data. ErrUnknownField = errors.New("unknown field") // ErrUnsupportedType error is returned when source contains data of type unsupported by this package. ErrUnsupportedType = errors.New("unsupported type") )
Functions ¶
This section is empty.
Types ¶
type Convertor ¶
type Convertor struct {
// contains filtered or unexported fields
}
Convertor structure that provides converting functionality. Don't create it manually, use Instance function instead.
func Instance ¶
func Instance() *Convertor
Instance function retrieves Convertor singleton instance.
Click to show internal directories.
Click to hide internal directories.