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

Method readTypeUnion

sio/bsupio/types.go:344–366  ·  view source on GitHub ↗
(b *buffer)

Source from the content-addressed store, hash-verified

342}
343
344func (d *Decoder) readTypeUnion(b *buffer) error {
345 ntyp, err := readUvarintAsInt(b)
346 if err != nil {
347 return errBadFormat
348 }
349 if ntyp == 0 {
350 return errors.New("type union: zero types not allowed")
351 }
352 if ntyp > super.MaxUnionTypes {
353 return fmt.Errorf("type union: too many types (%d)", ntyp)
354
355 }
356 types := make([]super.Type, 0, ntyp)
357 for range ntyp {
358 typ, err := d.readType(b)
359 if err != nil {
360 return err
361 }
362 types = append(types, typ)
363 }
364 d.enter(d.sctx.LookupTypeUnion(types))
365 return nil
366}
367
368func (d *Decoder) readTypeEnum(b *buffer) error {
369 nsym, err := readUvarintAsInt(b)

Callers 1

decodeMethod · 0.95

Calls 5

readTypeMethod · 0.95
enterMethod · 0.95
readUvarintAsIntFunction · 0.85
NewMethod · 0.80
LookupTypeUnionMethod · 0.80

Tested by

no test coverage detected