Skip to content

Commit

Permalink
Query builder whereNull and whereNotNull
Browse files Browse the repository at this point in the history
  • Loading branch information
donwilson committed Nov 1, 2023
1 parent 89df35c commit fa52fcc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Magnetar/Database/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,24 @@ public function whereRaw(string $where_clause): self {
return $this;
}

/**
* Only use rows where column value is null
* @param string $column Column name
* @return self
*/
public function whereNull(string $column): self {
return $this->where($column, null);
}

/**
* Only use rows where column value is not null
* @param string $column Column name
* @return self
*/
public function whereNotNull(string $column): self {
return $this->where($column, '!=', null);
}

/**
* Define the order by clause
* @param string $column_name Column name to order by
Expand Down

0 comments on commit fa52fcc

Please sign in to comment.