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

Method appendTypes

runtime/sam/expr/function/flatten.go:48–70  ·  view source on GitHub ↗
(types []super.Type, b scode.Bytes, typ *super.TypeRecord)

Source from the content-addressed store, hash-verified

46}
47
48func (n *Flatten) appendTypes(types []super.Type, b scode.Bytes, typ *super.TypeRecord) []super.Type {
49 it := scode.NewRecordIter(b, typ.Opts)
50 for _, f := range typ.Fields {
51 val, none := it.Next(f.Opt)
52 if none {
53 continue
54 }
55 if typ := super.TypeRecordOf(f.Type); typ != nil && val != nil {
56 types = n.appendTypes(types, val, typ)
57 continue
58 }
59 typ, ok := n.entryTypes[f.Type]
60 if !ok {
61 typ = n.sctx.MustLookupTypeRecord([]super.Field{
62 super.NewField("key", n.keyType),
63 super.NewField("value", f.Type),
64 })
65 n.entryTypes[f.Type] = typ
66 }
67 types = append(types, typ)
68 }
69 return types
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)

Callers 1

innerTypeOfMethod · 0.95

Calls 5

NextMethod · 0.95
NewRecordIterFunction · 0.92
TypeRecordOfFunction · 0.92
NewFieldFunction · 0.92
MustLookupTypeRecordMethod · 0.80

Tested by

no test coverage detected