-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a30e93
commit fe02e6d
Showing
1 changed file
with
1 addition
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,5 @@ | ||
import { sql, type AnyColumn, type SQLWrapper } from 'drizzle-orm' | ||
|
||
export function ascNullsEnd(column: SQLWrapper | AnyColumn) { | ||
return sql`ISNULL(${column}), ${column} asc` | ||
} | ||
|
||
export function descNullsEnd(column: SQLWrapper | AnyColumn) { | ||
return sql`ISNULL(${column}), ${column} desc` | ||
} | ||
|
||
export function ascNullsStart(column: SQLWrapper | AnyColumn) { | ||
return sql`NOT ISNULL(${column}), ${column} asc` | ||
} | ||
|
||
export function descNullsStart(column: SQLWrapper | AnyColumn) { | ||
return sql`NOT ISNULL(${column}), ${column} desc` | ||
return sql`${column} ASC NULLS LAST` | ||
} |