💚 Sponsor DRZL
- Every dollar speeds up CI hardware and offsets long test runs on my aging laptop.
- Sponsors get roadmap input and priority responses in GitHub Issues.
- Prefer a quick overview? The current goals and thank-yous are at https://use-drzl.github.io/drzl/sponsor.
Use
Add to drzl.config.ts:
generators: [
{
kind: 'service',
path: 'src/services',
dataAccess: 'drizzle',
schemaImportPath: 'src/db/schema',
databaseInjection: {
enabled: true,
databaseType: 'Database',
databaseTypeImport: { name: 'Database', from: 'src/db/db' },
},
},
];
Notes
- In drizzle mode, uses
$inferSelect/$inferInsertfor end‑to‑end types. Update<T>is derived fromInsert<T>with every primary‑key column omitted and fields partial.- Key parameters are typed from the primary key itself:
getById(id: string)for a varchar key,getById(orgId: number, userId: string)for a composite one (one parameter per key column, in key order). A table with no primary key emitsgetAllandcreateonly. databaseInjectionmakes services acceptdb: Database(or your chosen type) instead of importing a global singleton, which is ideal for serverless runtimes.