Skip to content

Commit 0206060

Browse files
committed
feat(enhance): add pluck/raw/expand statement modes
Add better-sqlite3-compatible statement modes to enhance(): - pluck(): return first column value only - raw(): return rows as arrays - expand(): return rows namespaced by table - stmt.database: back-reference to parent db Modes are mutually exclusive, matching better-sqlite3 toggle semantics. Expand mode uses arrays internally to handle duplicate column names.
1 parent 49e39ec commit 0206060

5 files changed

Lines changed: 1203 additions & 57 deletions

File tree

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.5.0] (2026-02-06)
6+
7+
### Added
8+
9+
- **Statement modes via `enhance()`**: `stmt.pluck()`, `stmt.raw()`, `stmt.expand()` for better-sqlite3 compatibility
10+
- `.pluck()` returns only the first column value from queries
11+
- `.raw()` returns rows as arrays instead of objects
12+
- `.expand()` returns rows namespaced by table, correctly handling duplicate column names across JOINs
13+
- All three modes are mutually exclusive, matching better-sqlite3's toggle semantics
14+
- **`stmt.database`**: Back-reference from prepared statements to their parent database instance
15+
- **`EnhancedStatementMethods` type**: TypeScript interface for `pluck()`, `raw()`, `expand()`, and `database`
16+
517
## [0.4.0] (2026-02-04)
618

719
API compatible with `node:sqlite` from Node.js v25.6.1.
@@ -118,6 +130,7 @@ API compatible with `node:sqlite` from Node.js v25.6.1.
118130
- macOS (x64, ARM64)
119131
- Linux (x64, ARM64), (glibc 2.28+, musl)
120132

133+
[0.5.0]: https://github.com/PhotoStructure/node-sqlite/releases/tag/v0.5.0
121134
[0.4.0]: https://github.com/PhotoStructure/node-sqlite/releases/tag/v0.4.0
122135
[0.3.0]: https://github.com/PhotoStructure/node-sqlite/releases/tag/v0.3.0
123136
[0.2.1]: https://github.com/PhotoStructure/node-sqlite/releases/tag/v0.2.1

0 commit comments

Comments
 (0)