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

Method Call

runtime/sam/expr/function/grep.go:15–29  ·  view source on GitHub ↗
(vals []super.Value)

Source from the content-addressed store, hash-verified

13}
14
15func (g *Grep) Call(vals []super.Value) super.Value {
16 patternVal, inputVal := vals[0], vals[1]
17 if super.TypeUnder(patternVal.Type()) != super.TypeString {
18 return g.sctx.WrapError("grep: pattern argument must be a string", patternVal)
19 }
20 if patternVal.IsNull() {
21 return super.Null
22 }
23 if p := patternVal.AsString(); g.grep == nil || g.pattern != p {
24 g.pattern = p
25 term := norm.NFC.Bytes(patternVal.Bytes())
26 g.grep = expr.NewSearchString(string(term), nil)
27 }
28 return g.grep.Eval(inputVal)
29}

Callers

nothing calls this directly

Calls 8

TypeUnderFunction · 0.92
NewSearchStringFunction · 0.92
WrapErrorMethod · 0.80
IsNullMethod · 0.80
AsStringMethod · 0.80
TypeMethod · 0.65
EvalMethod · 0.65
BytesMethod · 0.45

Tested by

no test coverage detected