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

Method encode

runtime/sam/expr/function/flatten.go:72–97  ·  view source on GitHub ↗
(typ *super.TypeRecord, inner super.Type, base field.Path, b scode.Bytes)

Source from the content-addressed store, hash-verified

70}
71
72func (n *Flatten) encode(typ *super.TypeRecord, inner super.Type, base field.Path, b scode.Bytes) {
73 it := scode.NewRecordIter(b, typ.Opts)
74 for _, f := range typ.Fields {
75 val, none := it.Next(f.Opt)
76 if none {
77 continue
78 }
79 key := append(base, f.Name)
80 if typ := super.TypeRecordOf(f.Type); typ != nil {
81 n.encode(typ, inner, key, val)
82 continue
83 }
84 typ := n.entryTypes[f.Type]
85 union, ok := inner.(*super.TypeUnion)
86 if ok {
87 super.BeginUnion(&n.Builder, union.TagOf(typ))
88 }
89 n.BeginContainer()
90 n.encodeKey(key)
91 n.Append(val)
92 n.EndContainer()
93 if ok {
94 n.EndContainer()
95 }
96 }
97}
98
99func (n *Flatten) encodeKey(key field.Path) {
100 n.BeginContainer()

Callers 1

CallMethod · 0.95

Calls 9

NextMethod · 0.95
encodeKeyMethod · 0.95
NewRecordIterFunction · 0.92
TypeRecordOfFunction · 0.92
BeginUnionFunction · 0.92
TagOfMethod · 0.80
BeginContainerMethod · 0.80
EndContainerMethod · 0.80
AppendMethod · 0.45

Tested by

no test coverage detected