capdux.org CP REGISTRY

@web/db

v1.0.0 MIT .cap ✓ Verified by capdux.org AI-First .d.cp

Official unified database context and request-scoped automatic transaction plugin for cap:web

Install with Cap
$ cap add @web/db

AI Interface Stub .d.cp

// Type definitions for CP

import { App, AppMethod, Context, Response, Plugin, PluginScope } from "../../../../lib/web/app.cp";
export enum DbDialect {
    Sqlite,
    Postgres,
    Mysql
}

export class DbPluginConfig {
    dialect: DbDialect,
    dsn: string,
    auto_tx: bool,
    tx_header: string,
}

export class DbTxStats {
    begins: u64,
    commits: u64,
    rollbacks: u64,
}

export fn dbDefaultTxAction(action: u8): bool;
export fn dbRunTxAction(action: u8): bool;
export fn dbStrEql(a: string, b: string): bool;
export fn dbIsWriteMethod(m: AppMethod): bool;
export fn dbTxStats(): DbTxStats;
export fn dbResetStats();
export fn dbBeforeHandle(ctx: &mut Context): bool;
export fn dbAfterHandle(ctx: &mut Context, resp: &mut Response);
export fn createDbPlugin(cfg: DbPluginConfig, action_fn: DbTxActionFn): Plugin;
export fn registerDbWithHook(app: &mut App, cfg: DbPluginConfig, action_fn: DbTxActionFn): &mut App;
export fn registerDb(app: &mut App, cfg: DbPluginConfig): &mut App;

README

Markdown

No README provided for this package version.

Version History

1 release
Version Format / Size Integrity (SHA-256) Downloads Published Status
v1.0.0 .cap · 3.3 KB sha256-f27829cafe2d8e53… 0 2026-11-26 latest