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

time.Time problem #6

Open
forever-eight opened this issue Apr 12, 2023 · 5 comments · May be fixed by #7
Open

time.Time problem #6

forever-eight opened this issue Apr 12, 2023 · 5 comments · May be fixed by #7

Comments

@forever-eight
Copy link

type User struct {
Name   string `bson:"name"`
Email  string `bson:"email"`
Member Member

}

type Member struct {
Name string bson:"name"
Type string bson:"type"
Date time.Time
}
u := User{
Name: "Bob",
Email: "[email protected]",
Member: Member{
Name: "Bobby",
Date: time.Now(),
},
}
encryptedOrder := deepcopy.MustAnything(u).(User)

time.Time won't work correctly

@forever-eight
Copy link
Author

Output (encryptedOrder) = {Bob [email protected] {Bobby 0001-01-01 00:00:00 +0000 UTC}}

@onyxg
Copy link

onyxg commented Jun 23, 2023

+1

@0cnLaroche
Copy link

Same issue here, is the PR going to be merged ?

@0cnLaroche
Copy link

0cnLaroche commented Feb 29, 2024

@forever-eight @onyxg Maintainer doesn't seem to be active so I forked the repo and made a fix handle the time.Time :

https://github.com/0cnLaroche/go-deepcopy

@brunoga
Copy link

brunoga commented Mar 1, 2024

FWIIW, I did a from scratch reimplementation of this here: https://github.com/brunoga/deep

Not only it supports time.Time, it also supports all unexported fields as long as they have a supported type.

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

Successfully merging a pull request may close this issue.

4 participants