Skip to main content

Module principal

Module principal 

Source
Expand description

Authenticated-principal task-local plumbing.

Hosts (Session / Transaction execute boundaries) install the current Principal into a Tokio task-local at the top of each query so deeper procedure / UDF invocation sites can read it without threading the principal through every internal API.

This module also exposes maybe_scope_with_principal — the convenience wrapper that collapses the match principal { Some(p) => scoped..., None => fut }.await pattern previously duplicated across uni::api::{session,transaction} and uni-query::df_udfs.

§Stability

Moved here in Phase 5 of the §1.2 consolidation pass. uni-query re-exports the items below for backwards compatibility.

Statics§

CURRENT_PRINCIPAL
Tokio task-local carrying the authenticated principal for the in-flight query.

Functions§

current_principal
Borrow the principal active for the current execute scope, if any.
maybe_scope_with_principal
Run fut either inside a principal task-local scope or unwrapped, depending on whether a principal was supplied.
scoped_with_principal
Run fut inside a scope where current_principal resolves to principal.