(pl *payloadIface, rdser *Serializer, v reflect.Value, fieldsoutcnt []int, cctagsPath []int16)
| 625 | } |
| 626 | |
| 627 | func (dec *Decoder) decodeValue(pl *payloadIface, rdser *Serializer, v reflect.Value, fieldsoutcnt []int, cctagsPath []int16) bool { |
| 628 | |
| 629 | ctag := rdser.GetCTag() |
| 630 | ctagType := ctag.Type() |
| 631 | |
| 632 | switch ctagType { |
| 633 | case TAG_END: |
| 634 | return false |
| 635 | case TAG_NULL: |
| 636 | return true |
| 637 | } |
| 638 | |
| 639 | ctagField := ctag.Field() |
| 640 | ctagName := ctag.Name() |
| 641 | |
| 642 | k := v.Kind() |
| 643 | initialV := v |
| 644 | if k == reflect.Ptr { |
| 645 | if v.IsNil() { |
| 646 | v.Set(reflect.New(v.Type().Elem())) |
| 647 | } |
| 648 | v = v.Elem() |
| 649 | k = v.Kind() |
| 650 | } |
| 651 | var idx *[]int |
| 652 | |
| 653 | mv, isMap := v, false |
| 654 | if ctagName != 0 { |
| 655 | cctagsPath = append(cctagsPath, ctagName) |
| 656 | if k == reflect.Interface || (k == reflect.Map && v.Type().Elem().Kind() == reflect.Interface) { |
| 657 | if v.IsNil() { |
| 658 | v.Set(reflect.ValueOf(make(map[string]any))) |
| 659 | } |
| 660 | mv = reflect.ValueOf(v.Interface()) |
| 661 | v, isMap = mkValue(ctagType), true |
| 662 | } else if k == reflect.Map { |
| 663 | if v.IsNil() { |
| 664 | v.Set(reflect.MakeMap(v.Type())) |
| 665 | } |
| 666 | mv = reflect.ValueOf(v.Interface()) |
| 667 | v, isMap = reflect.New(v.Type().Elem()).Elem(), true |
| 668 | } else if k == reflect.Struct { |
| 669 | |
| 670 | // try to find in cache in RO mode |
| 671 | idx = dec.ctagsCache.Find(cctagsPath) |
| 672 | |
| 673 | if idx == nil || len(*idx) == 0 { |
| 674 | dec.ResetSerializer() |
| 675 | dec.ser.WriteInts16(cctagsPath) |
| 676 | cctagsPathStr := string(dec.ser.Bytes()) |
| 677 | if _, ok := dec.ctagsCache.missing[cctagsPathStr]; ok { |
| 678 | // Tags path does not exists in go struct |
| 679 | return dec.skipStruct(pl, rdser, fieldsoutcnt, ctag) |
| 680 | } else { |
| 681 | // Tags path was not found in cache |
| 682 | name := dec.state.tagsMatcher.tag2name(ctagName) |
| 683 | // lock must be upgraded to exclusive here to add tag |
| 684 | dec.state.lock.RUnlock() |
no test coverage detected