Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ Or specify individual permissions:
"sqlite:allow-load",
"sqlite:allow-fetch-one",
"sqlite:allow-fetch-all",
// etc.
]
}
```
Expand Down Expand Up @@ -187,14 +186,14 @@ All query methods use `$1`, `$2`, etc. syntax with `SqlValue` types:
type SqlValue = string | number | boolean | null | Uint8Array
```

| SQLite Type | TypeScript Type | Notes |
| ----------- | --------------- | ----- |
| TEXT | `string` | Also for DATE, TIME, DATETIME |
| INTEGER | `number` | Integers preserved up to i64 range |
| REAL | `number` | Floating point |
| BOOLEAN | `boolean` | |
| NULL | `null` | |
| BLOB | `Uint8Array` | Binary data |
| SQLite Type | TypeScript Type | Notes |
| ----------- | --------------- | ----------------------------------- |
| TEXT | `string` | Also for DATE, TIME, DATETIME |
| INTEGER | `number` | Integers preserved up to i64 range |
| REAL | `number` | Floating point |
| BOOLEAN | `boolean` | |
| NULL | `null` | |
| BLOB | `Uint8Array` | Binary data |

> **Note:** JavaScript safely represents integers up to ±2^53 - 1. The plugin binds
> integers as SQLite's INTEGER type (i64), maintaining full precision within that range.
Expand Down Expand Up @@ -255,7 +254,7 @@ generated ID or other computed values, then using that data in subsequent writes

```typescript
// Begin transaction with initial insert
const tx = await db.executeInterruptibleTransaction([
let tx = await db.executeInterruptibleTransaction([
['INSERT INTO orders (user_id, total) VALUES ($1, $2)', [userId, 0]]
])

Expand All @@ -267,13 +266,13 @@ const orders = await tx.read<Array<{ id: number }>>(
const orderId = orders[0].id

// Continue transaction with the order ID
const tx2 = await tx.continue([
tx = await tx.continue([
['INSERT INTO order_items (order_id, product_id) VALUES ($1, $2)', [orderId, productId]],
['UPDATE orders SET total = $1 WHERE id = $2', [itemTotal, orderId]]
])

// Commit the transaction
await tx2.commit()
await tx.commit()
```

**Important:**
Expand Down Expand Up @@ -380,8 +379,8 @@ To see logs during development:

```toml
[dependencies]
tracing = { version = "0.1.41", default-features = false, features = ["std", "release_max_level_off"] }
tracing-subscriber = { version = "0.3.20", features = ["fmt", "env-filter"] }
tracing = { version = "0.1.x", default-features = false, features = ["std", "release_max_level_off"] }
tracing-subscriber = { version = "0.3.x", features = ["fmt", "env-filter"] }
```

```rust
Expand All @@ -390,6 +389,7 @@ fn init_tracing() {
use tracing_subscriber::{fmt, EnvFilter};
let filter = EnvFilter::try_from_default_env()
.unwrap_or_else(|_| EnvFilter::new("trace"));

fmt().with_env_filter(filter).compact().init();
}

Expand Down