chore: save local changes (by AI)
This commit is contained in:
parent
cc1a7b04a9
commit
e1be66a59d
10
convert.go
10
convert.go
@ -66,7 +66,7 @@ func performConversion(source, destination any) *reflect.Value {
|
||||
if realDestination.CanAddr() {
|
||||
address := realDestination.Addr().Interface()
|
||||
if unmarshaler, isJSONUnmarshaler := address.(json.Unmarshaler); isJSONUnmarshaler {
|
||||
_ = unmarshaler.UnmarshalJSON(cast.MustJsonBytes(realSource.Interface()))
|
||||
_ = unmarshaler.UnmarshalJSON(cast.MustJSONBytes(realSource.Interface()))
|
||||
return nil
|
||||
}
|
||||
if unmarshaler, isYAMLUnmarshaler := address.(yaml.Unmarshaler); isYAMLUnmarshaler {
|
||||
@ -109,7 +109,7 @@ func performConversion(source, destination any) *reflect.Value {
|
||||
|
||||
case reflect.Slice:
|
||||
if destinationType.Elem().Kind() == reflect.Uint8 {
|
||||
applyValue(realDestination, reflect.ValueOf(cast.MustJsonBytes(realSource.Interface())), &allocatedValue)
|
||||
applyValue(realDestination, reflect.ValueOf(cast.MustJSONBytes(realSource.Interface())), &allocatedValue)
|
||||
} else {
|
||||
normalizedSource := realSource
|
||||
if sourceType.Kind() == reflect.String {
|
||||
@ -122,7 +122,7 @@ func performConversion(source, destination any) *reflect.Value {
|
||||
normalizedSource = tempSlice
|
||||
} else {
|
||||
var rawList []any
|
||||
cast.UnJson(sourceStr, &rawList)
|
||||
cast.UnmarshalJSON(sourceStr, &rawList)
|
||||
normalizedSource = reflect.ValueOf(rawList)
|
||||
}
|
||||
} else if sourceType.Kind() != reflect.Slice {
|
||||
@ -141,7 +141,7 @@ func performConversion(source, destination any) *reflect.Value {
|
||||
convertStructToStruct(effectiveSource, realDestination)
|
||||
case reflect.String:
|
||||
var rawMap map[string]any
|
||||
cast.UnJson(effectiveSource.String(), &rawMap)
|
||||
cast.UnmarshalJSON(effectiveSource.String(), &rawMap)
|
||||
convertMapToStruct(reflect.ValueOf(rawMap), realDestination)
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ func performConversion(source, destination any) *reflect.Value {
|
||||
convertStructToMap(realSource, realDestination)
|
||||
case reflect.String:
|
||||
var rawMap map[string]any
|
||||
cast.UnJson(realSource.String(), &rawMap)
|
||||
cast.UnmarshalJSON(realSource.String(), &rawMap)
|
||||
convertMapToMap(reflect.ValueOf(rawMap), realDestination)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user