@cocoframe/database
v0.0.3
Published
Driver-neutral database connection and transaction lifecycle for CocoFrame.
Maintainers
Readme
@cocoframe/database
Small driver-neutral database lifecycle contract.
defineDatabaseAdapter(adapter)preserves a typed adapter contract.createDatabase(adapter)exposes saferun, optional transactions, and close behavior.DatabaseAdapterrequires acquire/release ownership and explicit transaction support.
const database = createDatabase(adapter);
const rows = await database.run((connection) => query(connection));Every acquired connection is released in a finally path. Unsupported
transactions fail explicitly. Query languages, migrations, pooling, and ORM
behavior belong to concrete adapters. Verify with tests/database.test.ts.
