Revert "refactor: replace DeepCopy with Copy for request handling consistency"

This reverts commit c21219fcff.
This commit is contained in:
CaIon
2025-08-28 15:11:55 +08:00
parent c21219fcff
commit f7c4eda0f3
12 changed files with 50 additions and 58 deletions

View File

@@ -6,21 +6,14 @@ import (
"github.com/jinzhu/copier"
)
func Copy[T any](src *T, deepCopy bool) (*T, error) {
func DeepCopy[T any](src *T) (*T, error) {
if src == nil {
return nil, fmt.Errorf("copy source cannot be nil")
}
var dst T
if deepCopy {
err := copier.CopyWithOption(&dst, src, copier.Option{DeepCopy: true, IgnoreEmpty: true})
if err != nil {
return nil, err
}
} else {
err := copier.Copy(&dst, src)
if err != nil {
return nil, err
}
err := copier.CopyWithOption(&dst, src, copier.Option{DeepCopy: true, IgnoreEmpty: true})
if err != nil {
return nil, err
}
return &dst, nil
}