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

Method Call

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

Source from the content-addressed store, hash-verified

54}
55
56func (r *Replace) Call(args []super.Value) super.Value {
57 args = underAll(args)
58 sVal := args[0]
59 oldVal := args[1]
60 newVal := args[2]
61 if sVal.IsNull() || oldVal.IsNull() || newVal.IsNull() {
62 return super.Null
63 }
64 for i := range args {
65 if !args[i].IsString() {
66 return r.sctx.WrapError("replace: string arg required", args[i])
67 }
68 }
69 s := super.DecodeString(sVal.Bytes())
70 old := super.DecodeString(oldVal.Bytes())
71 new := super.DecodeString(newVal.Bytes())
72 return super.NewString(strings.ReplaceAll(s, old, new))
73}
74
75type ToLower struct {
76 sctx *super.Context

Callers

nothing calls this directly

Calls 7

DecodeStringFunction · 0.92
NewStringFunction · 0.92
IsNullMethod · 0.80
IsStringMethod · 0.80
WrapErrorMethod · 0.80
underAllFunction · 0.70
BytesMethod · 0.45

Tested by

no test coverage detected