Documentation ¶
Index ¶
- Variables
- func Decode(typ reflect.Type, values map[string]string, prefix string, fn FieldName) interface{}
- func DecodeInto(obj interface{}, values map[string]string, prefix string, fn FieldName)
- func Encode(obj interface{}, prefix string, fn FieldName) map[string]string
- func PtrToStruct(ptr interface{}) interface{}
- type FieldName
- type NameValue
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // OptionalJSONTag uses field names defined in json tags, if available OptionalJSONTag = TrimOmitempty(OptionalTag("json")) )
Functions ¶
func DecodeInto ¶
DecodeInto decodes all values to hydrate the given object instance
func Encode ¶
Encode recursively encodes the object's properties as an ordered set of NameValue pairs
func PtrToStruct ¶
func PtrToStruct(ptr interface{}) interface{}
Types ¶
type FieldName ¶
type FieldName func(field reflect.StructField) (string, bool)
FieldName return a flag to indicate this is a valid field and a name to use
func OptionalTag ¶
OptionalTag given a tag name, will return the defined tag or fall back to lower camel case field name
func RequiredTag ¶
RequiredTag based on the given tag, only use a field if present
func TrimOmitempty ¶
TrimOmitempty trims `,omitempty` from the name
Click to show internal directories.
Click to hide internal directories.