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

Method LookupType

context.go:80–96  ·  view source on GitHub ↗
(id int)

Source from the content-addressed store, hash-verified

78}
79
80func (c *Context) LookupType(id int) (Type, error) {
81 if id < 0 {
82 return nil, fmt.Errorf("type id (%d) cannot be negative", id)
83 }
84 if id < IDTypeComplex {
85 return LookupPrimitiveByID(id)
86 }
87 c.mu.RLock()
88 defer c.mu.RUnlock()
89 if id >= len(c.byID) {
90 return nil, fmt.Errorf("type id (%d) not in type context (size %d)", id, len(c.byID))
91 }
92 if typ := c.byID[id]; typ != nil {
93 return typ, nil
94 }
95 return nil, fmt.Errorf("no type found for type id %d", id)
96}
97
98var keyPool = sync.Pool{
99 New: func() any {

Callers 1

Calls 1

LookupPrimitiveByIDFunction · 0.85

Tested by 1