(args ...vector.Any)
| 22 | } |
| 23 | |
| 24 | func (f *Fields) Call(args ...vector.Any) vector.Any { |
| 25 | if vec, ok := expr.CheckForNullThenError(args); ok { |
| 26 | return vec |
| 27 | } |
| 28 | val := vector.Under(args[0]) |
| 29 | switch typ := val.Type().(type) { |
| 30 | case *super.TypeRecord: |
| 31 | paths := buildPath(typ, nil) |
| 32 | s := vector.NewStringEmpty(val.Len()) |
| 33 | inOffs, outOffs := []uint32{0}, []uint32{0} |
| 34 | for i := uint32(0); i < val.Len(); i++ { |
| 35 | inOffs, outOffs = appendPaths(paths, s, inOffs, outOffs) |
| 36 | } |
| 37 | inner := vector.NewArray(f.innerTyp, inOffs, s) |
| 38 | return vector.NewArray(f.outerTyp, outOffs, inner) |
| 39 | case *super.TypeOfType: |
| 40 | var errs []uint32 |
| 41 | s := vector.NewStringEmpty(val.Len()) |
| 42 | inOffs, outOffs := []uint32{0}, []uint32{0} |
| 43 | for i := uint32(0); i < val.Len(); i++ { |
| 44 | b := vector.TypeValueValue(val, i) |
| 45 | rtyp := f.recordType(b) |
| 46 | if rtyp == nil { |
| 47 | errs = append(errs, i) |
| 48 | continue |
| 49 | } |
| 50 | inOffs, outOffs = appendPaths(buildPath(rtyp, nil), s, inOffs, outOffs) |
| 51 | } |
| 52 | inner := vector.NewArray(f.innerTyp, inOffs, s) |
| 53 | out := vector.NewArray(f.outerTyp, outOffs, inner) |
| 54 | if len(errs) > 0 { |
| 55 | return vector.Combine(out, errs, vector.NewStringError(f.sctx, "missing", uint32(len(errs)))) |
| 56 | } |
| 57 | return out |
| 58 | default: |
| 59 | return vector.NewStringError(f.sctx, "missing", val.Len()) |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | func (f *Fields) recordType(b []byte) *super.TypeRecord { |
| 64 | typ, err := f.sctx.LookupByValue(b) |
nothing calls this directly
no test coverage detected