(args ...vector.Any)
| 113 | } |
| 114 | |
| 115 | func (p *Position) Call(args ...vector.Any) vector.Any { |
| 116 | if vec, ok := expr.CheckForNullThenError(args); ok { |
| 117 | return vec |
| 118 | } |
| 119 | args = underAll(args) |
| 120 | vec, subVec := args[0], args[1] |
| 121 | if vec.Type().ID() != super.IDString { |
| 122 | return vector.NewWrappedError(p.sctx, "position: string arguments required", vec) |
| 123 | } |
| 124 | if subVec.Type().ID() != super.IDString { |
| 125 | return vector.NewWrappedError(p.sctx, "position: string arguments required", subVec) |
| 126 | } |
| 127 | vals := make([]int64, vec.Len()) |
| 128 | for i := range vec.Len() { |
| 129 | s := vector.StringValue(vec, i) |
| 130 | sub := vector.StringValue(subVec, i) |
| 131 | vals[i] = int64(strings.Index(s, sub) + 1) |
| 132 | } |
| 133 | return vector.NewInt(super.TypeInt64, vals) |
| 134 | } |
| 135 | |
| 136 | type Replace struct { |
| 137 | sctx *super.Context |
nothing calls this directly
no test coverage detected