Documentation ¶
Index ¶
- Variables
- func Convert(obj interface{}) (url.Values, error)
- func MapFormJSON(ptr interface{}, form map[string][]string) error
- func MapFormWithTag(ptr interface{}, form map[string][]string, tag string) error
- func MapURI(ptr interface{}, m map[string][]string) error
- func MappingByPtr(ptr interface{}, setter Setter, tag string) error
- type FormSource
- type Marshaler
- type Setter
- type Unmarshaler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnknownType = errors.New("unknown type") // ErrConvertMapStringSlice can not covert to map[string][]string ErrConvertMapStringSlice = errors.New("can not convert to map slices of strings") // ErrConvertToMapString can not convert to map[string]string ErrConvertToMapString = errors.New("can not convert to map of strings") )
Functions ¶
func Convert ¶
Convert takes an object and converts it to a url.Values object using JSON tags as parameter names. Only top-level simple values, arrays, and slices are serialized. Embedded structs, maps, etc. will not be serialized.
func MapFormJSON ¶
func MapFormWithTag ¶
func MappingByPtr ¶
Types ¶
type FormSource ¶
func (FormSource) TrySet ¶
func (form FormSource) TrySet(value reflect.Value, field reflect.StructField, tagValue string, opt setOptions) (isSet bool, err error)
TrySet tries to set a value by request's form source (like map[string][]string)
type Setter ¶
type Setter interface {
TrySet(value reflect.Value, field reflect.StructField, key string, opt setOptions) (isSet bool, err error)
}
Setter tries to set value on a walking by fields of a struct
type Unmarshaler ¶
Unmarshaler converts a string representation to an object
Click to show internal directories.
Click to hide internal directories.