mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-06-08 07:15:15 -04:00
Sql cleanups
This commit is contained in:
+5
-1
@@ -95,10 +95,14 @@ export function values(items: Record<string, unknown>[]) {
|
||||
};
|
||||
}
|
||||
|
||||
export const coalesce = <T>(val: SQL<T> | Column, def: SQL<T>) => {
|
||||
export const coalesce = <T>(val: SQL<T> | Column, def: SQL<T> | Column) => {
|
||||
return sql<T>`coalesce(${val}, ${def})`;
|
||||
};
|
||||
|
||||
export const nullif = <T>(val: SQL<T> | Column, eq: SQL<T>) => {
|
||||
return sql<T>`nullif(${val}, ${eq})`;
|
||||
};
|
||||
|
||||
export const jsonbObjectAgg = <T>(key: SQLWrapper, value: SQL<T>) => {
|
||||
return sql<
|
||||
Record<string, T>
|
||||
|
||||
Reference in New Issue
Block a user