Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Map ¶
func Map(source, dest interface{}, options ...MapOptions) error
Map fills out the fields in dest with values from source. All fields in the destination object must exist in the source object.
Object hierarchies with nested structs and slices are supported, as long as type types of nested structs/slices follow the same rules, i.e. all fields in destination structs must be found on the source struct.
Embedded/anonymous structs are supported
Values that are not exported/not public will not be mapped.
It is a design decision to panic when a field cannot be mapped in the destination to ensure that a renamed field in either the source or destination does not result in subtle silent bug.
Types ¶
type MapOptions ¶ added in v0.0.19
type MapOptions int64
const ( Loose MapOptions = 1 RequestForm MapOptions = 2 RequestFormWithJsonTag MapOptions = 3 )
Click to show internal directories.
Click to hide internal directories.