ReviewOS

also looking at this

stacks/bun-query-builder

fix(client)!: bind db.raw and db.sql fragment values or refuse them

#1152
Merged glennmichael123 wants to merge fix/db-sql-raw-bindings into main
16 files +455 -118
docs/select.mdmodified+5-2
Changes to docs/select.md
@@ -200,11 +200,14 @@ const neverUpdated = await db
200200## Raw Where Clauses
201201
202202```typescript
203import { raw } from 'bun-query-builder'
203204
204// Raw SQL in where
205// Raw SQL in where: one fragment, no bindings. The interpolated Date is
206// inlined as an escaped literal; use where() to bind request input.
207const since = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000)
205208const activeRecent = await db
206209 .selectFrom('users')
207 .whereRaw('DATE(created_at) > DATE_SUB(NOW(), INTERVAL 30 DAY)')
210 .whereRaw(raw`created_at > ${since}`)
208211 .get()
209212
210213```