mirror of
https://github.com/yusing/godoxy.git
synced 2026-01-11 22:30:47 +01:00
fix(serialization): correctly handle json tag
This commit is contained in:
@@ -211,6 +211,10 @@ func initTypeKeyFieldIndexesMap(t reflect.Type) typeInfo {
|
||||
deserializeTag := field.Tag.Get(tagDeserialize)
|
||||
jsonTag := field.Tag.Get(tagJSON)
|
||||
|
||||
if jsonTag != "" {
|
||||
jsonTag, _, _ = strings.Cut(jsonTag, ",")
|
||||
}
|
||||
|
||||
if deserializeTag == "-" || jsonTag == "-" {
|
||||
continue
|
||||
}
|
||||
@@ -508,10 +512,10 @@ func ConvertString(src string, dst reflect.Value) (convertible bool, convErr gpe
|
||||
}
|
||||
|
||||
// Early return for empty string
|
||||
if src == "" {
|
||||
dst.SetZero()
|
||||
return true, nil
|
||||
}
|
||||
if src == "" {
|
||||
dst.SetZero()
|
||||
return true, nil
|
||||
}
|
||||
|
||||
switch dstT {
|
||||
case reflect.TypeFor[time.Duration]():
|
||||
|
||||
Reference in New Issue
Block a user