bynk.test.peek_write
Error A D1.peek handle is asked to write, by a write operation (run, batch) or by a statement that would write; the handle is read-only.
A D1.peek handle is read-only: it offers all, first, select[T] and firstAs[T], and a statement that would write (INSERT, UPDATE, DELETE, a schema change) is refused, as is run or batch. A case makes the app write by driving the app.
Example
suite shop.orders as system { case "peeks" { let db = D1.peek(shop.orders.Orders) let a <- db.all("DELETE FROM orders", []) // ✗ the statement writes let r <- db.all("SELECT id FROM orders", []) // ✓ expect true }}In the Book
See also
- The grammar rule it governs:
case. - Every code in its category, Tests, on the diagnostic index.
bynk explain bynk.test.peek_writeshows the same from the installed toolchain, without a network.