Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/QueryBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,29 @@ export class QueryBuilder<TModel, TDelegate extends ModelQuerySchemaLike = Model
return this.where({ [key]: { not: null } } as QuerySchemaWhere<TDelegate>)
}

/**
* 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<TKey extends keyof ModelAttributes<TModel> & string>(key: TKey): this {
return this.orWhere({ [key]: null } as QuerySchemaWhere<TDelegate>)
}

/**
* Adds an OR not-null check for a key. The OR counterpart of {@link whereNotNull}.
*
* @param key
* @returns
*/
public orWhereNotNull<TKey extends keyof ModelAttributes<TModel> & string>(key: TKey): this {
return this.orWhere({ [key]: { not: null } } as QuerySchemaWhere<TDelegate>)
}

/**
* Adds a between range clause for a key.
*
Expand Down
Loading