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

Function checkSet

value.go:503–519  ·  view source on GitHub ↗
(body scode.Bytes)

Source from the content-addressed store, hash-verified

501}
502
503func checkSet(body scode.Bytes) error {
504 it := body.Iter()
505 var prev scode.Bytes
506 for !it.Done() {
507 tagAndBody := it.NextTagAndBody()
508 if prev != nil {
509 switch bytes.Compare(prev, tagAndBody) {
510 case 0:
511 return errors.New("invalid BSUP: duplicate set element")
512 case 1:
513 return errors.New("invalid BSUP: set elements not sorted")
514 }
515 }
516 prev = tagAndBody
517 }
518 return nil
519}
520
521func checkEnum(typ *TypeEnum, body scode.Bytes) error {
522 if selector := DecodeUint(body); int(selector) >= len(typ.Symbols) {

Callers 1

ValidateMethod · 0.85

Calls 5

IterMethod · 0.80
NextTagAndBodyMethod · 0.80
NewMethod · 0.80
DoneMethod · 0.45
CompareMethod · 0.45

Tested by

no test coverage detected