Skip to main content
@usenarrator/plugin-drizzle The Drizzle plugin is the most complete plugin in the repository and a good reference if you are writing your own. It reads the query builder as a description of the rows you get back, reads SQL operators as conditions, and reads table definitions as a list of columns with their constraints.
npm install @usenarrator/plugin-drizzle also installs @usenarrator/plugin-sql, which reads sql`...` templates holding whole statements. You don’t need to add sql() yourself unless you want raw SQL strings elsewhere read too.

Queries

Select with conditions, ordering and a limit
English
Pattern matching and ranges
English
Inserts with conflict handling
English

Relational queries

findMany with relations
English

Transactions

A transaction with a rollback
English

Schemas

A Postgres table
English

What it covers

  • Query builders: select, selectDistinct, selectDistinctOn, insert, update, delete, joins, groupBy, having, orderBy, limit, offset, returning, onConflictDoUpdate, onConflictDoNothing, subqueries with .as(), and CTEs with $with.
  • Operators: eq, ne, gt, gte, lt, lte, and, or, not, inArray, isNull, like, ilike, between, exists, the array operators and their negations.
  • sql tagged templates, shown with their full SQL text.
  • Relational queries: findMany and findFirst, including the object-style where from relational queries v2.
  • transaction, rollback, batch and $count.
  • Schemas for Postgres, MySQL, SQLite and SingleStore tables, column modifiers, indexes and constraints, enums, relations and defineRelations.

Translating

The English phrasebook is exported as en and typed as DrizzlePhrases.