v0.0.415 add 'tagkey' to gojson.Decoder
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m45s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m45s
This commit is contained in:
@@ -217,6 +217,7 @@ type decodeState struct {
|
||||
savedError error
|
||||
useNumber bool
|
||||
disallowUnknownFields bool
|
||||
tagkey *string
|
||||
}
|
||||
|
||||
// readIndex returns the position of the last byte read.
|
||||
@@ -652,7 +653,11 @@ func (d *decodeState) object(v reflect.Value) error {
|
||||
v.Set(reflect.MakeMap(t))
|
||||
}
|
||||
case reflect.Struct:
|
||||
fields = cachedTypeFields(t)
|
||||
tagkey := "json"
|
||||
if d.tagkey != nil {
|
||||
tagkey = *d.tagkey
|
||||
}
|
||||
fields = cachedTypeFields(t, tagkey)
|
||||
// ok
|
||||
default:
|
||||
d.saveError(&UnmarshalTypeError{Value: "object", Type: t, Offset: int64(d.off)})
|
||||
|
Reference in New Issue
Block a user