SPB Git

Repository Public

db.ts 523 B 11 lines typescript

1import postgres from "postgres";2import { env } from "./env";34declare global { var __sheetSql: ReturnType<typeof postgres> | undefined; }56export const sql = globalThis.__sheetSql ?? (globalThis.__sheetSql = postgres(env.databaseUrl, { max: 10, idle_timeout: 30, onnotice: () => {} }));7export type Sql = typeof sql;8export type Tx = postgres.TransactionSql;9export const j = (v: unknown) => sql.json(v as never);10export const iso = (d: Date | string | null | undefined) => (d == null ? null : new Date(d).toISOString());11
Files main
Menu

Theme