Skip to content

Commit bc915b3

Browse files
committed
Add $eq to Filter
1 parent dc17e15 commit bc915b3

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "strontium",
3-
"version": "2.7.7",
3+
"version": "2.7.8",
44
"description": "Strontium is a TypeScript toolkit for High Performance API servers built for Production not Projects.",
55
"main": "lib/src/index.js",
66
"types": "lib/src/index.d.ts",

src/query/abstract/Filter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ export type FieldFilter<P extends keyof T, T> =
44
| {
55
$in?: Array<T[P]>
66
$nin?: Array<T[P]>
7+
$eq?: T[P]
8+
// TODO: Review if the null type on $neq is necessary
79
$neq?: T[P] | null
810
$gt?: T[P]
911
$gte?: T[P]

src/query/drivers/sql/SQLFilterCompiler.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ export const compileSQLFilter: FilterCompiler<[string, Array<any>]> = (
7676
queries.push(["?? < ?", [field, subquery.$lt]])
7777
} else if (subquery.$lte !== undefined) {
7878
queries.push(["?? <= ?", [field, subquery.$lte]])
79+
} else if (subquery.$eq !== undefined) {
80+
queries.push(["?? = ?", [field, subquery.$eq]])
7981
} else {
8082
queries.push(["?? = ?", [field, subquery]])
8183
}

0 commit comments

Comments
 (0)