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

Method nth

value.go:319–339  ·  view source on GitHub ↗
(n int)

Source from the content-addressed store, hash-verified

317}
318
319func (r Value) nth(n int) (scode.Bytes, bool, bool) {
320 if typ := TypeRecordOf(r.typ); typ != nil {
321 var elem scode.Bytes
322 var none bool
323 for i, it := 0, scode.NewRecordIter(r.Bytes(), typ.Opts); i <= n; i++ {
324 if it.Done() {
325 return nil, false, false
326 }
327 elem, none = it.Next(typ.Fields[i].Opt)
328 }
329 return elem, none, true
330 }
331 var zv scode.Bytes
332 for i, it := 0, r.Bytes().Iter(); i <= n; i++ {
333 if it.Done() {
334 return nil, false, false
335 }
336 zv = it.Next()
337 }
338 return zv, false, true
339}
340
341func (r Value) Fields() []Field {
342 return TypeRecordOf(r.Type()).Fields

Callers 1

DerefByColumnMethod · 0.95

Calls 6

BytesMethod · 0.95
DoneMethod · 0.95
NextMethod · 0.95
NewRecordIterFunction · 0.92
TypeRecordOfFunction · 0.85
IterMethod · 0.80

Tested by

no test coverage detected