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

How to copy from one data type to another data type with same name? #34

Closed
kumarsiva07 opened this issue Apr 18, 2018 · 4 comments
Closed

Comments

@kumarsiva07
Copy link

// Model
type User struct {
	JoinedAt   time.Time
	ReleavedAt *time.Time
}

// Resource
type UserResource struct {
	JoinedAt   string
	ReceivedAt string
}

Want to copy from User to UserResource.

@daluu
Copy link

daluu commented May 16, 2018

I wonder if that's possible (at the moment), as it would require casting the data types in the copy process.

@ilius
Copy link

ilius commented Sep 6, 2019

Can you cast time.Time to string?
You need to specify the format somehow (unless it's JSON-specific)

@tomdevelops
Copy link
Contributor

hey, i know i'm a little bit late for the party 😅, but i made a PR #115 to make these kind of type conversions via a converter option. Have a look into the PR for an example, should be simliar to yours. cheers tom

@uded
Copy link
Collaborator

uded commented Jan 6, 2023

Closing as it is addressed via #115

@uded uded closed this as completed Jan 6, 2023
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

5 participants