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

Function walkUnion

walk.go:74–89  ·  view source on GitHub ↗
(typ *TypeUnion, body scode.Bytes, visit Visitor)

Source from the content-addressed store, hash-verified

72}
73
74func walkUnion(typ *TypeUnion, body scode.Bytes, visit Visitor) error {
75 if len(body) == 0 {
76 return errors.New("union has empty body")
77 }
78 it := body.Iter()
79 tag := DecodeUint(it.Next())
80 inner, err := typ.Type(int(tag))
81 if err != nil {
82 return err
83 }
84 body = it.Next()
85 if !it.Done() {
86 return errors.New("union value container has more than two items")
87 }
88 return Walk(inner, body, visit)
89}
90
91func walkSet(typ *TypeSet, body scode.Bytes, visit Visitor) error {
92 inner := TypeUnder(InnerType(typ))

Callers 1

WalkFunction · 0.85

Calls 7

DecodeUintFunction · 0.85
NewMethod · 0.80
IterMethod · 0.80
WalkFunction · 0.70
TypeMethod · 0.65
NextMethod · 0.45
DoneMethod · 0.45

Tested by

no test coverage detected