gutil_copy.go 632 B

1234567891011121314151617181920
  1. // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
  2. //
  3. // This Source Code Form is subject to the terms of the MIT License.
  4. // If a copy of the MIT was not distributed with this file,
  5. // You can obtain one at https://github.com/gogf/gf.
  6. package gutil
  7. import (
  8. "github.com/gogf/gf/v2/internal/deepcopy"
  9. )
  10. // Copy returns a deep copy of v.
  11. //
  12. // Copy is unable to copy unexported fields in a struct (lowercase field names).
  13. // Unexported fields can't be reflected by the Go runtime and therefore
  14. // they can't perform any data copies.
  15. func Copy(src interface{}) (dst interface{}) {
  16. return deepcopy.Copy(src)
  17. }