MCPcopy Create free account
hub / github.com/Restream/reindexer / skipStruct

Method skipStruct

cjson/decoder.go:67–108  ·  view source on GitHub ↗
(pl *payloadIface, rdser *Serializer, fieldsoutcnt []int, tag ctag)

Source from the content-addressed store, hash-verified

65}
66
67func (dec *Decoder) skipStruct(pl *payloadIface, rdser *Serializer, fieldsoutcnt []int, tag ctag) bool {
68 ctagType := tag.Type()
69
70 if ctagType == TAG_END {
71 return false
72 }
73 ctagField := tag.Field()
74
75 //fmt.Printf("skipping '%s' %s\n", dec.state.tagsMatcher.tag2name(tag.Name()), tag.Dump())
76
77 if ctagField >= 0 {
78 cnt := &fieldsoutcnt[ctagField]
79 switch ctagType {
80 case TAG_ARRAY:
81 count := int(rdser.GetVarUInt())
82 *cnt += count
83 default:
84 (*cnt)++
85 }
86 } else {
87 switch ctagType {
88 case TAG_OBJECT:
89 for dec.skipStruct(pl, rdser, fieldsoutcnt, rdser.GetCTag()) {
90 }
91 case TAG_ARRAY:
92 atag := rdser.GetCArrayTag()
93 count := atag.Count()
94 subtag := atag.Tag()
95 for range count {
96 switch subtag {
97 case TAG_OBJECT:
98 dec.skipStruct(pl, rdser, fieldsoutcnt, rdser.GetCTag())
99 default:
100 skipTag(rdser, subtag)
101 }
102 }
103 default:
104 skipTag(rdser, ctagType)
105 }
106 }
107 return true
108}
109func skipTag(rdser *Serializer, tagType int16) {
110 switch tagType {
111 case TAG_DOUBLE:

Callers 1

decodeValueMethod · 0.95

Calls 8

skipTagFunction · 0.85
TypeMethod · 0.65
FieldMethod · 0.45
GetVarUIntMethod · 0.45
GetCTagMethod · 0.45
GetCArrayTagMethod · 0.45
CountMethod · 0.45
TagMethod · 0.45

Tested by

no test coverage detected