automapper

package
v0.0.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2022 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Map

func Map(source, dest interface{})

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.

func MapLoose

func MapLoose(source, dest interface{})

MapLoose works just like Map, except it doesn't fail when the destination type contains fields not supplied by the source.

This function is meant to be a temporary solution - the general idea is that the Map function should take a number of options that can modify its behavior - but I'd rather not add that functionality before I have a better idea what is a good options format.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL