Custom field name mappings to copy values with different names in fromValue and toValue types. Examples can be found in copier_different_field_name_test.go.
resolve #139
type User1 struct {
Id int64
Name string
Address []string
}
type User2 struct {
Id2 int64
Name2 string
Address2 []string
}
u1 := User1{Id: 1, Name: "1", Address: []string{"1"}}
var u2 User2
err := copier.CopyWithOption(&u2, u1, copier.Option{FieldNameMapping: []copier.FieldNameMapping{
{SrcType: u1, DstType: u2,
Mapping: map[string]string{
"Id": "Id2",
"Name": "Name2",
"Address": "Address2"}},
}})
Custom field name mappings to copy values with different names in
fromValue
andtoValue
types. Examples can be found incopier_different_field_name_test.go
.resolve #139