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

Function LookupPrimitiveByID

type.go:279–329  ·  view source on GitHub ↗
(id int)

Source from the content-addressed store, hash-verified

277}
278
279func LookupPrimitiveByID(id int) (Type, error) {
280 if id < 0 {
281 return nil, fmt.Errorf("negative type ID: %d", id)
282 }
283 if id >= IDTypeComplex {
284 return nil, fmt.Errorf("type ID too large for primitive: %d", id)
285 }
286 switch id {
287 case IDBool:
288 return TypeBool, nil
289 case IDInt8:
290 return TypeInt8, nil
291 case IDUint8:
292 return TypeUint8, nil
293 case IDInt16:
294 return TypeInt16, nil
295 case IDUint16:
296 return TypeUint16, nil
297 case IDInt32:
298 return TypeInt32, nil
299 case IDUint32:
300 return TypeUint32, nil
301 case IDInt64:
302 return TypeInt64, nil
303 case IDUint64:
304 return TypeUint64, nil
305 case IDFloat16:
306 return TypeFloat16, nil
307 case IDFloat32:
308 return TypeFloat32, nil
309 case IDFloat64:
310 return TypeFloat64, nil
311 case IDBytes:
312 return TypeBytes, nil
313 case IDString:
314 return TypeString, nil
315 case IDIP:
316 return TypeIP, nil
317 case IDNet:
318 return TypeNet, nil
319 case IDTime:
320 return TypeTime, nil
321 case IDDuration:
322 return TypeDuration, nil
323 case IDType:
324 return TypeType, nil
325 case IDNull:
326 return TypeNull, nil
327 }
328 return nil, fmt.Errorf("primitive type ID %d not implemented", id)
329}
330
331// Utilities shared by complex types (ie, set and array)
332

Callers 5

formatTypeValueMethod · 0.92
coerceValsFunction · 0.92
LookupTypeMethod · 0.92
LookupTypeMethod · 0.85
DecodeTypeValueMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected