MCPcopy Create free account
hub / github.com/brimdata/super / Next

Method Next

scode/iter.go:21–36  ·  view source on GitHub ↗

Next returns the body of the next value along with a boolean that is true if the value is a container. It returns an empty slice for an empty or zero-length value and nil for a super null value. The container boolean is not meaningful if the returned Bytes slice is nil. Next panics if the next va

()

Source from the content-addressed store, hash-verified

19// meaningful if the returned Bytes slice is nil. Next panics if the next value
20// is malformed.
21func (i *Iter) Next() Bytes {
22 // The tag is zero for a null value; otherwise, it is the value's
23 // length plus one.
24 u64, n := binary.Uvarint(*i)
25 if n <= 0 {
26 panic(fmt.Sprintf("bad uvarint: %d", n))
27 }
28 if tagIsNull(u64) {
29 *i = (*i)[n:]
30 return nil
31 }
32 end := n + tagLength(u64)
33 val := (*i)[n:end]
34 *i = (*i)[end:]
35 return Bytes(val)
36}
37
38// NextTagAndBody returns the next value as a slice containing the value's
39// undecoded tag followed by its body. NextTagAndBody panics if the next

Callers 15

DerefMethod · 0.45
DerefFusionMethod · 0.45
UntagMethod · 0.45
ArrayIndexMethod · 0.45
ElementsMethod · 0.45
ContainerLengthMethod · 0.45
walkArrayFunction · 0.45
walkUnionFunction · 0.45
walkSetFunction · 0.45
walkMapFunction · 0.45
WriteMethod · 0.45
WriteMethod · 0.45

Calls 3

tagIsNullFunction · 0.85
tagLengthFunction · 0.85
BytesTypeAlias · 0.70

Tested by 1

TestAppendFunction · 0.36