Documentation
¶
Index ¶
- Variables
- func DeStramp(kv KV, i interface{}) error
- func Get(key string, i interface{}) (interface{}, error)
- func Key(parts ...string) string
- func UnMarshal(prefix string, kv KV, i interface{}) error
- func UnMarshalFloat(prefix string, kv KV, i interface{}) error
- func UnMarshalInt(prefix string, kv KV, i interface{}) error
- func UnMarshalSlice(prefix string, kv KV, i interface{}) error
- func UnMarshalString(prefix string, kv KV, i interface{}) error
- func UnMarshalStruct(prefix string, kv KV, i interface{}) error
- type IndexKeyFn
- type KV
- func Marshal(prefix string, i interface{}) (KV, error)
- func MarshalFloat(prefix string, i interface{}) (KV, error)
- func MarshalInt(prefix string, i interface{}) (KV, error)
- func MarshalSlice(prefix string, i interface{}) (KV, error)
- func MarshalString(prefix string, i interface{}) (KV, error)
- func MarshalStruct(prefix string, i interface{}) (KV, error)
- func Stramp(i interface{}) (KV, error)
- type KeyIndexFn
- type Marshaler
- type UnMarshaler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MarshalChain []Marshaler ErrTypeMismatch = errors.New("type mismatch") ErrUnsupportedType = errors.New("unsupported type") ErrFailedMarshal = errors.New("failed to marshal") )
View Source
var ( // Sep is the key separator for nested keys Sep = "." // TagKey is the tag prefix for struct fields TagKey = "stramp" // RequireTag defines if struct fields which do not have a tag named TagKey should be ignored. // If false, the field's name will be used if no tag has been set. RequireTag = false // IndexKey translates a slice index into a string key IndexKey = func(i int) string { return strconv.FormatInt(int64(i), 10) } KeyIndex = func(i string) int { x, err := strconv.ParseInt(i, 10, 64) if err != nil { return -1 } return int(x) } )
View Source
var ( UnMarshalChain []UnMarshaler ErrImmutableType = errors.New("destination type is immutable") ErrFailedUnMarshal = errors.New("failed to unmarshal") ErrMissingKey = errors.New("missing key") )
View Source
var (
ErrNotStruct = errors.New("attempt to stramp non-struct type")
)
View Source
var (
ErrUnknownField = errors.New("unknown field")
)
Functions ¶
func UnMarshalFloat ¶
func UnMarshalInt ¶
func UnMarshalSlice ¶
func UnMarshalString ¶
func UnMarshalStruct ¶
Types ¶
type IndexKeyFn ¶
IndexKeyFn is a function that translates a slice index into a string key.
type KV ¶
KV is a string -> string mapping
func MarshalFloat ¶
func MarshalInt ¶
func MarshalSlice ¶
func MarshalString ¶
func MarshalStruct ¶
type KeyIndexFn ¶
KeyIndexFn is a function that translates a string key into a slice index.
type UnMarshaler ¶
Click to show internal directories.
Click to hide internal directories.