Skip to content

Commit

Permalink
Query Primitives Any operator (#1004)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaidashenko authored Jan 21, 2025
1 parent 62443f4 commit 3e179a7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/types/query/primitives/primitives.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ type ValueComparator struct {
Operator ComparisonOperator
}

// AnyOperator - represents SQL's `ANY (array expression)` operator. Useful to replace multiple comparators joined with OR.
// i.e. allows to replace `field1 >= v1 OR field1 >= v2 OR field1 >= v3` with `field1 >= ANY(v1, v2, v3)`
type AnyOperator []any

func Any[T any](slice []T) AnyOperator {
result := make([]any, len(slice))
for i, v := range slice {
result[i] = v
}
return result
}

// Comparator is used to filter over values that belong to key data.
type Comparator struct {
Name string
Expand Down

0 comments on commit 3e179a7

Please sign in to comment.