Skip to content

Commit 49e39ec

Browse files
committed
chore(doc): standardize grammar
1 parent 3b2d6ce commit 49e39ec

12 files changed

Lines changed: 393 additions & 1301 deletions

doc/CRITICAL-FIXES-PLAN.md

Lines changed: 0 additions & 931 deletions
This file was deleted.

doc/advanced-patterns.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Advanced Patterns
1+
# Advanced patterns
22

33
This guide covers advanced usage patterns including worker threads, database backups, sessions/changesets, and performance optimization.
44

5-
## Worker Thread Support
5+
## Worker thread support
66

77
This package has full support for Node.js worker threads. Each worker thread gets its own isolated SQLite environment.
88

9-
### Basic Worker Thread Usage
9+
### Basic worker thread usage
1010

1111
**main.js:**
1212

@@ -63,7 +63,7 @@ process.on("exit", () => {
6363
});
6464
```
6565

66-
### Worker Pool Pattern
66+
### Worker pool pattern
6767

6868
```javascript
6969
const { Worker } = require("worker_threads");
@@ -165,9 +165,9 @@ const results = await Promise.all([
165165
await pool.close();
166166
```
167167

168-
## Database Backups
168+
## Database backups
169169

170-
### Simple Backup
170+
### Simple backup
171171

172172
```javascript
173173
const { DatabaseSync } = require("@photostructure/sqlite");
@@ -189,7 +189,7 @@ async function backupDatabase(sourcePath, backupPath) {
189189
await backupDatabase("./production.db", "./backup-2024-01-15.db");
190190
```
191191

192-
### Backup with Progress Monitoring
192+
### Backup with progress monitoring
193193

194194
```javascript
195195
async function backupWithProgress(sourcePath, backupPath) {
@@ -213,7 +213,7 @@ async function backupWithProgress(sourcePath, backupPath) {
213213
}
214214
```
215215

216-
### Automated Backup Strategy
216+
### Automated backup strategy
217217

218218
```javascript
219219
const fs = require("fs").promises;
@@ -287,11 +287,11 @@ const backupManager = new DatabaseBackupManager("./app.db", "./backups", {
287287
backupManager.startAutoBackup();
288288
```
289289

290-
## Session-based Change Tracking
290+
## Session-based change tracking
291291

292292
SQLite's session extension allows you to record changes and apply them to other databases - perfect for synchronization, replication, or undo/redo functionality.
293293

294-
### Basic Change Tracking
294+
### Basic change tracking
295295

296296
```javascript
297297
const { DatabaseSync } = require("@photostructure/sqlite");
@@ -325,7 +325,7 @@ db.close();
325325
replicaDb.close();
326326
```
327327

328-
### Conflict Resolution
328+
### Conflict resolution
329329

330330
```javascript
331331
const { DatabaseSync, constants } = require("@photostructure/sqlite");
@@ -371,7 +371,7 @@ function syncDatabases(primaryPath, replicaPath) {
371371
}
372372
```
373373

374-
### Change Tracking Example
374+
### Change tracking example
375375

376376
Sessions track changes that can be applied to other databases for synchronization:
377377

@@ -412,9 +412,9 @@ targetDb.close();
412412

413413
> **Note:** The `changesetInvert()` function for creating inverse changesets is not currently exposed in the JavaScript API. For undo/redo functionality, consider storing the original data before modifications or using SQLite triggers to maintain a history table.
414414
415-
## Performance Optimization
415+
## Performance optimization
416416

417-
### URI Configuration for Performance
417+
### URI configuration for performance
418418

419419
```javascript
420420
// High-performance read-only configuration
@@ -430,7 +430,7 @@ const db = new DatabaseSync("large.db");
430430
db.exec("PRAGMA mmap_size = 268435456"); // 256MB memory map
431431
```
432432

433-
### Connection Pooling
433+
### Connection pooling
434434

435435
```javascript
436436
class DatabasePool {
@@ -490,7 +490,7 @@ const results = await Promise.all([
490490
pool.close();
491491
```
492492

493-
### Bulk Operations
493+
### Bulk operations
494494

495495
```javascript
496496
// Efficient bulk insert
@@ -533,9 +533,9 @@ console.log(
533533
);
534534
```
535535

536-
## Memory Management
536+
## Memory management
537537

538-
### Setting Memory Limits
538+
### Setting memory limits
539539

540540
```javascript
541541
const db = new DatabaseSync("app.db");
@@ -552,7 +552,7 @@ const memoryUsed = db.prepare("PRAGMA cache_stats").get();
552552
console.log("Cache statistics:", memoryUsed);
553553
```
554554

555-
## Next Steps
555+
## Next steps
556556

557557
- [Extending SQLite](./extending-sqlite.md) - Custom functions and extensions
558558
- [API Reference](./api-reference.md) - Complete API documentation

doc/api-reference.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# API Reference
1+
# API reference
22

33
Complete API documentation for @photostructure/sqlite. This package provides 100% compatibility with Node.js's built-in SQLite module.
44

5-
## Table of Contents
5+
## Table of contents
66

7-
- [Module Exports](#module-exports)
8-
- [Enhancement Utilities](#enhancement-utilities)
7+
- [Module exports](#module-exports)
8+
- [Enhancement utilities](#enhancement-utilities)
99
- [DatabaseSync](#databasesync)
1010
- [StatementSync](#statementsync)
11-
- [Types and Interfaces](#types-and-interfaces)
11+
- [Types and interfaces](#types-and-interfaces)
1212
- [Constants](#constants)
13-
- [Error Handling](#error-handling)
13+
- [Error handling](#error-handling)
1414

15-
## Module Exports
15+
## Module exports
1616

1717
The module exports the following items that match `node:sqlite`:
1818

@@ -26,7 +26,7 @@ import {
2626
} from "@photostructure/sqlite";
2727
```
2828

29-
Additionally, this package provides enhancement utilities for (some) better-sqlite3 compatibility:
29+
This package also provides enhancement utilities for (some) better-sqlite3 compatibility:
3030

3131
```typescript
3232
import {
@@ -72,7 +72,7 @@ await backup(db, "backup.db", {
7272
});
7373
```
7474

75-
## Enhancement Utilities
75+
## Enhancement utilities
7676

7777
These utilities add better-sqlite3-style convenience methods to database instances. They are an extension beyond the `node:sqlite` API.
7878

@@ -129,7 +129,7 @@ if (isEnhanced(db)) {
129129
}
130130
```
131131

132-
### Enhanced Methods
132+
### Enhanced methods
133133

134134
When a database is enhanced, it gains these methods:
135135

@@ -195,7 +195,7 @@ insertMany.exclusive(["Eve"]); // BEGIN EXCLUSIVE
195195
insertMany.deferred(["Frank"]); // BEGIN DEFERRED (default)
196196
```
197197

198-
**Nested Transactions:** When called inside an existing transaction, uses savepoints automatically:
198+
**Nested transactions:** When called inside an existing transaction, uses savepoints automatically:
199199

200200
```javascript
201201
const outer = db.transaction(() => {
@@ -816,7 +816,7 @@ stmt.get(42);
816816
console.log(stmt.expandedSQL); // "SELECT * FROM users WHERE id = 42"
817817
```
818818

819-
## Types and Interfaces
819+
## Types and interfaces
820820

821821
### DatabaseSyncOptions
822822

@@ -978,7 +978,7 @@ constants.SQLITE_SELECT;
978978
// ... and more
979979
```
980980

981-
### TypeScript Type Categories
981+
### TypeScript type categories
982982

983983
> **Note:** These categorized type interfaces are an extension provided by `@photostructure/sqlite`.
984984
> The `node:sqlite` module exports only a flat `constants` object without these type categories.
@@ -998,7 +998,7 @@ import {
998998
} from "@photostructure/sqlite";
999999
```
10001000

1001-
#### SqliteOpenFlags (Extension)
1001+
#### SqliteOpenFlags (extension)
10021002

10031003
Database open flags. **These constants are an extension beyond `node:sqlite`** - the `node:sqlite` module does not export `SQLITE_OPEN_*` constants.
10041004

@@ -1066,7 +1066,7 @@ Action codes passed to `setAuthorizer()` callbacks (34 total):
10661066
| `SQLITE_DETACH` | Detach a database |
10671067
| ... | (24 more action codes) |
10681068

1069-
### Using Type Categories
1069+
### Using type categories
10701070

10711071
The categorized types enable strongly-typed function signatures:
10721072

@@ -1091,9 +1091,9 @@ db.applyChangeset(changeset, {
10911091
});
10921092
```
10931093

1094-
## Error Handling
1094+
## Error handling
10951095

1096-
All errors thrown include enhanced information:
1096+
All errors include additional information:
10971097

10981098
```typescript
10991099
interface SQLiteError extends Error {
@@ -1116,7 +1116,7 @@ try {
11161116
}
11171117
```
11181118

1119-
## See Also
1119+
## See also
11201120

11211121
- [SQLite C API Reference](./reference/sqlite-api.md) - Low-level C API documentation
11221122
- [Working with Data](./working-with-data.md) - Practical examples and patterns

0 commit comments

Comments
 (0)