Skip to main content

db

Macro db 

Source
macro_rules! db {
    () => { ... };
    ($request_root:expr) => { ... };
}
Expand description

Access the active request’s database session.

Use db!() in ordinary generated endpoints and nested helpers. Every call shares the execution counters installed at request entry. Manual IC-CDK, framework, and timer entries establish that boundary with request_execution; lifecycle callbacks declared by the composed start! form receive it automatically.

db!(&request_root) is the explicit low-level integration form for a framework that already owns a request root. Obtain that root from db::with_request_execution_root; passing it never creates fresh counters and fails if a different root is already active.