mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-06-08 07:15:15 -04:00
Cleanup video join in entries
This commit is contained in:
@@ -94,10 +94,18 @@ export function values(items: Record<string, unknown>[]) {
|
||||
};
|
||||
}
|
||||
|
||||
export const coalesce = (val: SQLWrapper, def: SQLWrapper) => {
|
||||
return sql`coalesce(${val}, ${def})`;
|
||||
};
|
||||
|
||||
export const jsonbObjectAgg = (key: SQLWrapper, value: SQLWrapper) => {
|
||||
return sql`jsonb_object_agg(${sql.join([key, value], sql.raw(","))})`;
|
||||
};
|
||||
|
||||
export const jsonbAgg = (val: SQLWrapper) => {
|
||||
return sql`jsonb_agg(${val})`;
|
||||
};
|
||||
|
||||
export const jsonbBuildObject = (select: Record<string, SQLWrapper>) => {
|
||||
const query = sql.join(
|
||||
Object.entries(select).flatMap(([k, v]) => {
|
||||
|
||||
Reference in New Issue
Block a user