pub struct SqlxLowerer<B, P, M = OrdinalProjection> { /* private fields */ }Expand description
SQLx lowerer for gatekeep residual policies.
Implementations§
Source§impl<B, P> SqlxLowerer<B, P, OrdinalProjection>where
B: GatekeepSqlxBackend,
impl<B, P> SqlxLowerer<B, P, OrdinalProjection>where
B: GatekeepSqlxBackend,
Sourcepub fn new(predicates: P, tenant_column: TenantColumn) -> Self
pub fn new(predicates: P, tenant_column: TenantColumn) -> Self
Builds a lowerer using ordinal grade projection.
Source§impl<B, P, M> SqlxLowerer<B, P, M>where
B: GatekeepSqlxBackend,
impl<B, P, M> SqlxLowerer<B, P, M>where
B: GatekeepSqlxBackend,
Sourcepub fn with_projection(
predicates: P,
projection: M,
tenant_column: TenantColumn,
) -> Self
pub fn with_projection( predicates: P, projection: M, tenant_column: TenantColumn, ) -> Self
Builds a lowerer using a caller-supplied projection strategy.
Sourcepub fn unmapped_facts<O>(
&self,
residual: &ResidualPolicy<O>,
cx: &Context,
) -> Vec<FactId>where
P: SqlxFactPredicates<B>,
pub fn unmapped_facts<O>(
&self,
residual: &ResidualPolicy<O>,
cx: &Context,
) -> Vec<FactId>where
P: SqlxFactPredicates<B>,
Lists all query-deferred facts without a trusted SQL mapping. Request facts already resolved by partial evaluation are not reported.
Sourcepub fn lower_result<O>(
&self,
result: &Residual<O>,
cx: &Context,
) -> Result<Lowered<SqlxFragment<B>, SqlxFragment<B>>, LowerError>where
P: SqlxFactPredicates<B>,
M: OutcomeProjection<B, O>,
pub fn lower_result<O>(
&self,
result: &Residual<O>,
cx: &Context,
) -> Result<Lowered<SqlxFragment<B>, SqlxFragment<B>>, LowerError>where
P: SqlxFactPredicates<B>,
M: OutcomeProjection<B, O>,
Lowers a partial-evaluation result with tenant guards on filter and grade.
Both resolved and pending policies use this path. Apply the filter before counting or paginating. SQL lowering does not produce per-row audit traces.
§Errors
Returns missing-mapping or non-total-grade errors. Obligations remain application-owned prerequisites; a SQL projection does not execute them.
Sourcepub fn lower_filter<O>(
&self,
residual: &ResidualPolicy<O>,
cx: &Context,
) -> Result<SqlxFragment<B>, LowerError>where
P: SqlxFactPredicates<B>,
pub fn lower_filter<O>(
&self,
residual: &ResidualPolicy<O>,
cx: &Context,
) -> Result<SqlxFragment<B>, LowerError>where
P: SqlxFactPredicates<B>,
Lowers only the Boolean filter. This works for every outcome lattice.
§Errors
Returns LowerError::Unlowerable when a residual fact has no trusted
predicate mapping.
Sourcepub fn enforce_tenant_filter(
&self,
policy: SqlxFragment<B>,
cx: &Context,
) -> SqlxFragment<B>
pub fn enforce_tenant_filter( &self, policy: SqlxFragment<B>, cx: &Context, ) -> SqlxFragment<B>
Adds the mandatory typed tenant predicate to an already-built filter.
lower and lower_filter call this automatically. This method is
public for applications that have already resolved a policy in memory
and need to combine its constant filter with the same tenant safety
contract.
Sourcepub fn enforce_tenant_projection(
&self,
grade: SqlxFragment<B>,
cx: &Context,
) -> SqlxFragment<B>
pub fn enforce_tenant_projection( &self, grade: SqlxFragment<B>, cx: &Context, ) -> SqlxFragment<B>
Adds the mandatory tenant guard to a manually constructed grade
projection. Callers that consume a gatekeep::Lowered from an
in-memory resolved branch must apply this before selecting the grade;
Self::lower applies it automatically.
Trait Implementations§
Source§impl<B: Clone, P: Clone, M: Clone> Clone for SqlxLowerer<B, P, M>
impl<B: Clone, P: Clone, M: Clone> Clone for SqlxLowerer<B, P, M>
Source§fn clone(&self) -> SqlxLowerer<B, P, M>
fn clone(&self) -> SqlxLowerer<B, P, M>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<O, B, P, M> QueryLowering<O> for SqlxLowerer<B, P, M>
impl<O, B, P, M> QueryLowering<O> for SqlxLowerer<B, P, M>
Source§type Filter = SqlxFragment<B>
type Filter = SqlxFragment<B>
Source§type Projection = SqlxFragment<B>
type Projection = SqlxFragment<B>
Source§fn lower(
&self,
residual: &ResidualPolicy<O>,
cx: &Context,
) -> Result<Lowered<Self::Filter, Self::Projection>, LowerError>
fn lower( &self, residual: &ResidualPolicy<O>, cx: &Context, ) -> Result<Lowered<Self::Filter, Self::Projection>, LowerError>
Auto Trait Implementations§
impl<B, P, M> Freeze for SqlxLowerer<B, P, M>
impl<B, P, M> RefUnwindSafe for SqlxLowerer<B, P, M>
impl<B, P, M> Send for SqlxLowerer<B, P, M>
impl<B, P, M> Sync for SqlxLowerer<B, P, M>
impl<B, P, M> Unpin for SqlxLowerer<B, P, M>
impl<B, P, M> UnsafeUnpin for SqlxLowerer<B, P, M>
impl<B, P, M> UnwindSafe for SqlxLowerer<B, P, M>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more