* chore: get bookings with kysely * fixup! chore: get bookings with kysely * replace left joins with inner joins * add missing filter and count with kysely * main query done * kysely use connection string * fix attendee emails operator * fix immutability and add attendee email filter * chore: everything working but date filters * limit offset * chore: bump platform libraries * fix bookingseat / attendee user email filter * refactor, clean, and subquery updatedAt/createdAt * fix import kysely types path * fix missing references and payments fields * create kysely module in apiv2 * fix before created at filter * fix types * update yarn.lock * update yarn.lock --------- Co-authored-by: Keith Williams <keithwillcode@gmail.com>
15 lines
409 B
TypeScript
15 lines
409 B
TypeScript
import type { ExpressionBuilder, StringReference } from "kysely";
|
|
import { sql } from "kysely";
|
|
|
|
export function traverseJSON<DB, TB extends keyof DB>(
|
|
eb: ExpressionBuilder<DB, TB>,
|
|
column: StringReference<DB, TB>,
|
|
path: string | [string, ...string[]]
|
|
) {
|
|
if (!Array.isArray(path)) {
|
|
path = [path];
|
|
}
|
|
|
|
return sql`${sql.ref(column)}->${sql.raw(path.map((item) => `'${item}'`).join("->"))}`;
|
|
}
|