Skip to content

kern-ormFully typed query builder for PostgreSQL

Load related records in one SQL statement, run transactions without passing them around, and reuse tables across tenant schemas.

Load forms with their fields in one SQL statement:

ts
const forms = await db.form
  .where({ published: true })
  .select("id", "name")
  .select(form => ({
    fields: form.fields.select("id", "label"),
  }))
// forms: { id: string; name: string; fields: { id: string; label: string }[] }[]

See Related Records for filtering, nesting, and reusing related records.