cp.go 419 B

12345678910111213141516171819
  1. package cputil
  2. import (
  3. "github.com/jinzhu/copier"
  4. )
  5. func ShallowCopy(toValue interface{}, fromValue interface{}) error {
  6. return copier.CopyWithOption(toValue, fromValue, copier.Option{
  7. IgnoreEmpty: true,
  8. DeepCopy: false,
  9. })
  10. }
  11. func DeepCopy(toValue interface{}, fromValue interface{}) error {
  12. return copier.CopyWithOption(toValue, fromValue, copier.Option{
  13. IgnoreEmpty: true,
  14. DeepCopy: true,
  15. })
  16. }