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

Function Contains

runtime/sam/expr/boolean.go:268–278  ·  view source on GitHub ↗

Given a predicate for comparing individual elements, produce a new predicate that implements the "in" comparison.

(compare Boolean)

Source from the content-addressed store, hash-verified

266// Given a predicate for comparing individual elements, produce a new
267// predicate that implements the "in" comparison.
268func Contains(compare Boolean) Boolean {
269 return func(val super.Value) super.Value {
270 err := val.Walk(func(typ super.Type, body scode.Bytes) error {
271 if compare(super.NewValue(typ, body)) == super.True {
272 return errMatch
273 }
274 return nil
275 })
276 return super.NewBool(err == errMatch)
277 }
278}
279
280// Comparison returns a Predicate for comparing this value to other values.
281// The op argument is one of "==", "!=", "<", "<=", ">", ">=".

Callers 1

compileRegexpSearchMethod · 0.92

Calls 4

NewValueFunction · 0.92
NewBoolFunction · 0.92
compareFunction · 0.85
WalkMethod · 0.80

Tested by

no test coverage detected