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. sqltagged templates, shown with their full SQL text.- Relational queries:
findManyandfindFirst, including the object-stylewherefrom relational queries v2. transaction,rollback,batchand$count.- Schemas for Postgres, MySQL, SQLite and SingleStore tables, column modifiers, indexes and constraints, enums,
relationsanddefineRelations.
Translating
The English phrasebook is exported asen and typed as DrizzlePhrases.