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

Question: no clone #20

Closed
matthieuzbo opened this issue Nov 3, 2023 · 3 comments
Closed

Question: no clone #20

matthieuzbo opened this issue Nov 3, 2023 · 3 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@matthieuzbo
Copy link

Hi,

Just a question about your package: If I want a field not to be copied, do I use SetCustomFunc or is there a tag system (like jinzhu copier package copier:"-")?

Thanks

@huandu huandu added the question Further information is requested label Nov 3, 2023
@huandu
Copy link
Owner

huandu commented Nov 4, 2023

There is no tag system in this package. It's easy to use custom func to ignore a field. Here is a sample: https://go.dev/play/p/mKsbn8YsRWz

As you can see in the sample, in this package, ignoring a field is the same as setting a zero value to the field after cloned.

@matthieuzbo
Copy link
Author

Thanks.

@huandu
Copy link
Owner

huandu commented Nov 6, 2023

I find that struct tags can be much more efficient than custom func, so I add a new feature to support tag system. Check out this new feature in the latest release.

@huandu huandu added the enhancement New feature or request label Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants