MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / getNonEmptyArrayOfObjects

Function getNonEmptyArrayOfObjects

cmd/cql-proxy/resolver/resolver.go:571–596  ·  view source on GitHub ↗
(v interface{})

Source from the content-addressed store, hash-verified

569}
570
571func getNonEmptyArrayOfObjects(v interface{}) (res []map[string]interface{}, err error) {
572 arr, ok := v.([]interface{})
573 if !ok {
574 err = errors.New("requires array argument")
575 return
576 }
577 if len(arr) == 0 {
578 err = errors.New("requires non-empty array argument")
579 return
580 }
581
582 for _, v := range arr {
583 var (
584 o map[string]interface{}
585 ok bool
586 )
587
588 if o, ok = v.(map[string]interface{}); !ok {
589 err = errors.New("requires array full of objects")
590 return
591 }
592 res = append(res, o)
593 }
594
595 return
596}

Callers 1

ResolveFilterFunction · 0.85

Calls 1

NewMethod · 0.65

Tested by

no test coverage detected