Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy different field name, the original field had no value #106

Open
mingzaily opened this issue Jul 15, 2021 · 0 comments
Open

Copy different field name, the original field had no value #106

mingzaily opened this issue Jul 15, 2021 · 0 comments
Assignees

Comments

@mingzaily
Copy link

Describe the feature

define

    type SrcTags struct {
        FieldA string
        FieldB string
    }

    type DestTags struct {
        FieldA string
        FieldB string
        FieldC string `copier:"FieldA"`
    }

    dst := &DestTags{}
    src := &SrcTags{
        FieldA: "A",
        FieldB: "B",
    }

now, the original field had no value

    copier.Copy(dst, src)
    fmt.Printf("%+v", dst)
    // &{FieldA: FieldB:B FieldC:A}

i want the original field had value

    copier.Copy(dst, src)
    fmt.Printf("%+v", dst)
    // &{FieldA:A FieldB:B FieldC:A}

Motivation

Hope to have this feature,I can only use loops now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants