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

Method Call

runtime/sam/expr/function/string.go:37–50  ·  view source on GitHub ↗
(args []super.Value)

Source from the content-addressed store, hash-verified

35}
36
37func (p *Position) Call(args []super.Value) super.Value {
38 val, subVal := args[0], args[1]
39 if val.IsNull() || subVal.IsNull() {
40 return super.Null
41 }
42 if !val.IsString() {
43 return p.sctx.WrapError("position: string arguments required", val)
44 }
45 if !subVal.IsString() {
46 return p.sctx.WrapError("position: string arguments required", subVal)
47 }
48 i := strings.Index(val.AsString(), subVal.AsString())
49 return super.NewInt64(int64(i + 1))
50}
51
52type Replace struct {
53 sctx *super.Context

Callers

nothing calls this directly

Calls 6

NewInt64Function · 0.92
IsNullMethod · 0.80
IsStringMethod · 0.80
WrapErrorMethod · 0.80
IndexMethod · 0.80
AsStringMethod · 0.80

Tested by

no test coverage detected