Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddConversion ¶
AddConversion registers a custom converter used by MapToStruct, StructToMap and StructToStruct when no automatic rule applies. When both TSrcField and TDestField are non-pointer base types, all three pointer variants (*Src->Dest, Src->*Dest, *Src->*Dest) are automatically registered as well.
func MapToStruct ¶
MapToStruct copies values from src map into dest struct fields matched by "json" tags. dest must be a non-nil pointer to a struct.
func StructToMap ¶
StructToMap converts a struct into a map[string]any using "json" tags as keys. src must be a non-nil pointer to a struct.
func StructToStruct ¶
StructToStruct copies fields from src to dest matched by "json" tag keys. Both src and dest must be non-nil pointers to structs.