Documentation ¶
Index ¶
- Variables
- func Deref(t reflect.Type) reflect.Type
- func Repr(v interface{}) string
- func UnmarshalJsonBytes(content []byte, v interface{}) error
- func UnmarshalJsonReader(reader io.Reader, v interface{}) error
- func UnmarshalKey(m map[string]interface{}, v interface{}) error
- func UnmarshalYamlBytes(content []byte, v interface{}) error
- func UnmarshalYamlReader(reader io.Reader, v interface{}) error
- func ValidatePtr(v *reflect.Value) error
- type MapValuer
- type UnmarshalOption
- type Unmarshaler
- type Valuer
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsupportedType is an error that indicates the config format is not supported. ErrUnsupportedType = errors.New("only map-like configs are suported") )
Functions ¶
func UnmarshalJsonBytes ¶
UnmarshalJsonBytes unmarshals content into v.
func UnmarshalJsonReader ¶
UnmarshalJsonReader unmarshals content from reader into v.
func UnmarshalKey ¶
UnmarshalKey unmarshals m into v with tag key.
func UnmarshalYamlBytes ¶
UnmarshalYamlBytes unmarshals content into v.
func UnmarshalYamlReader ¶
UnmarshalYamlReader unmarshals content from reader into v.
func ValidatePtr ¶
ValidatePtr validates v if it's a valid pointer.
Types ¶
type MapValuer ¶
type MapValuer map[string]interface{}
A MapValuer is a map that can use Value method to get values with given keys.
type UnmarshalOption ¶
type UnmarshalOption func(*unmarshalOptions)
UnmarshalOption defines the method to customize a Unmarshaler.
func WithCanonicalKeyFunc ¶
func WithCanonicalKeyFunc(f func(string) string) UnmarshalOption
WithCanonicalKeyFunc customizes a Unmarshaler with Canonical Key func
func WithStringValues ¶
func WithStringValues() UnmarshalOption
WithStringValues customizes a Unmarshaler with number values from strings.
type Unmarshaler ¶
type Unmarshaler struct {
// contains filtered or unexported fields
}
A Unmarshaler is used to unmarshal with given tag key.
func NewUnmarshaler ¶
func NewUnmarshaler(key string, opts ...UnmarshalOption) *Unmarshaler
NewUnmarshaler returns a Unmarshaler.
func (*Unmarshaler) Unmarshal ¶
func (u *Unmarshaler) Unmarshal(m map[string]interface{}, v interface{}) error
Unmarshal unmarshals m into v.
func (*Unmarshaler) UnmarshalValuer ¶
func (u *Unmarshaler) UnmarshalValuer(m Valuer, v interface{}) error
UnmarshalValuer unmarshals m into v.