Add StructToStruct
This commit is contained in:
@@ -4,10 +4,15 @@ import (
|
||||
"log"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
|
||||
"github.com/go-viper/mapstructure/v2"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
func StructToStruct(source any, target any) {
|
||||
mapstructure.Decode(source, &target)
|
||||
}
|
||||
|
||||
// StructToMapRecursive given a struct or a primitive will return the equivalent
|
||||
// map[string]any of the struct or the primitive as is.
|
||||
func StructToMapRecursive(obj any) any {
|
||||
|
||||
Reference in New Issue
Block a user