feat: make queues durable by default and add seed helpers
This commit is contained in:
@@ -297,3 +297,16 @@ const users = await usersRepo.all({
|
||||
Repository SQL identifiers are validated and values remain parameterized. Placeholder generation is dialect-aware: PostgreSQL uses `$1`, `$2`, and SQLite/MySQL use `?`. List limits are bounded.
|
||||
|
||||
`retryTransaction()` retries recognized serialization, deadlock, and database-lock errors by default. Supply `shouldRetry` for application-specific retryable errors; ordinary validation or business errors are not retried automatically.
|
||||
|
||||
## Reusable seed helpers
|
||||
|
||||
```ts
|
||||
import { addSeedData, removeSeedData, runSeedQuery, getDb } from "@wrnexus/db";
|
||||
|
||||
await addSeedData(getDb, [{ code: "free", credits: 100 }], "plans", { conflict: "ignore" });
|
||||
await removeSeedData(getDb(), { code: "legacy" }, "plans");
|
||||
await runSeedQuery(getDb(), "UPDATE plans SET credits = ? WHERE code = ?", [200, "free"]);
|
||||
```
|
||||
|
||||
Table and column identifiers are validated, values are always parameterized, and empty bulk
|
||||
deletes are refused unless `{ all: true }` is explicit.
|
||||
|
||||
Reference in New Issue
Block a user