copier
copier copied to clipboard
How to copy from one data type to another data type with same name?
// 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.
I wonder if that's possible (at the moment), as it would require casting the data types in the copy process.
Can you cast time.Time
to string?
You need to specify the format somehow (unless it's JSON-specific)
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
Closing as it is addressed via #115