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. *