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

Method ContainerLength

value.go:214–240  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

212}
213
214func (v Value) ContainerLength() (int, error) {
215 switch v.Type().(type) {
216 case *TypeSet, *TypeArray:
217 if v.IsNull() {
218 return 0, nil
219 }
220 var n int
221 for it := v.ContainerIter(); !it.Done(); {
222 it.Next()
223 n++
224 }
225 return n, nil
226 case *TypeMap:
227 if v.IsNull() {
228 return 0, nil
229 }
230 var n int
231 for it := v.ContainerIter(); !it.Done(); {
232 it.Next()
233 it.Next()
234 n++
235 }
236 return n, nil
237 default:
238 return -1, ErrNotContainer
239 }
240}
241
242// IsNull returns true when v's underlying type is TypeNull.
243func (v Value) IsNull() bool {

Callers 3

formatVectorMethod · 0.80
EvalMethod · 0.80
CallMethod · 0.80

Calls 5

TypeMethod · 0.95
IsNullMethod · 0.95
ContainerIterMethod · 0.95
DoneMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected