From aaf7f3e39f382b566f6497cf305aaf88fb87eb99 Mon Sep 17 00:00:00 2001 From: 3m1n3nc3 Date: Thu, 30 Jul 2026 06:03:07 +0100 Subject: [PATCH] feat: add orWhereNull and orWhereNotNull to QueryBuilder class. --- src/QueryBuilder.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/QueryBuilder.ts b/src/QueryBuilder.ts index fa31e3d..a14d962 100644 --- a/src/QueryBuilder.ts +++ b/src/QueryBuilder.ts @@ -434,6 +434,29 @@ export class QueryBuilder) } + /** + * Adds an OR null check for a key. + * + * The OR counterpart of {@link whereNull}, so a null check can be combined + * inside a grouped `where` callback, e.g. `q.whereFuture('expiresAt').orWhereNull('expiresAt')`. + * + * @param key + * @returns + */ + public orWhereNull & string>(key: TKey): this { + return this.orWhere({ [key]: null } as QuerySchemaWhere) + } + + /** + * Adds an OR not-null check for a key. The OR counterpart of {@link whereNotNull}. + * + * @param key + * @returns + */ + public orWhereNotNull & string>(key: TKey): this { + return this.orWhere({ [key]: { not: null } } as QuerySchemaWhere) + } + /** * Adds a between range clause for a key. *