Documentation
¶
Overview ¶
Package parse implements a reflection-based mechanism of converting a string (e.g. from an environment variable or from a struct field) into a Go type for the struct.
Index ¶
- func BinaryUnmarshalerFrom(field *structs.Field) (b encoding.BinaryUnmarshaler)
- func BinaryUnmarshalerFromValue(field reflect.Value) (b encoding.BinaryUnmarshaler)
- func IsDecodable(field *structs.Field) bool
- func Parse(value string, field reflect.Value) error
- func ParseField(value string, field *structs.Field) error
- func TextUnmarshalerFrom(field *structs.Field) (t encoding.TextUnmarshaler)
- func TextUnmarshalerFromValue(field reflect.Value) (t encoding.TextUnmarshaler)
- type Decoder
- type Setter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinaryUnmarshalerFrom ¶
func BinaryUnmarshalerFrom(field *structs.Field) (b encoding.BinaryUnmarshaler)
Attempts to get an encoding.BinaryUnmarshaler variable from the specified field.
func BinaryUnmarshalerFromValue ¶
func BinaryUnmarshalerFromValue(field reflect.Value) (b encoding.BinaryUnmarshaler)
Attempts to get an encoding.BinaryUnmarshaler variable from the specified value.
func IsDecodable ¶
Returns true if the field implements one of the decodable interfaces.
func ParseField ¶
ParseField parses the given type from the field and sets it.
func TextUnmarshalerFrom ¶
func TextUnmarshalerFrom(field *structs.Field) (t encoding.TextUnmarshaler)
Attempts to get an encoding.TextUnmarshaler variable from the specified field.
func TextUnmarshalerFromValue ¶
func TextUnmarshalerFromValue(field reflect.Value) (t encoding.TextUnmarshaler)
Attempts to get an encoding.TextUnmarshaler variable from the specified value.
Types ¶
type Decoder ¶
Decoder has the same semantics as Setter, but takes higher precedence.
func DecoderFrom ¶
Attempts to get a Decoder variable from the specified field.
func DecoderFromValue ¶
Attempts to get a Decoder variable from the specified value.
type Setter ¶
Setter is implemented by types can self-deserialize values. Any type that implements flag.Value also implements Setter.
func SetterFrom ¶
Attempts to get a Setter variable from the specified field.
func SetterFromValue ¶
Attempts to get a Setter variable from the specified value.