Skip to main content

SqlxLowerer

Struct SqlxLowerer 

Source
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>

Source

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>

Source

pub fn with_projection( predicates: P, projection: M, tenant_column: TenantColumn, ) -> Self

Builds a lowerer using a caller-supplied projection strategy.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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>

Source§

fn clone(&self) -> SqlxLowerer<B, P, M>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<B: Debug, P: Debug, M: Debug> Debug for SqlxLowerer<B, P, M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<O, B, P, M> QueryLowering<O> for SqlxLowerer<B, P, M>

Source§

type Filter = SqlxFragment<B>

Backend-specific boolean filter type.
Source§

type Projection = SqlxFragment<B>

Backend-specific grade projection type.
Source§

fn lower( &self, residual: &ResidualPolicy<O>, cx: &Context, ) -> Result<Lowered<Self::Filter, Self::Projection>, LowerError>

Lowers a residual policy for an authorized-list query. Read more

Auto Trait Implementations§

§

impl<B, P, M> Freeze for SqlxLowerer<B, P, M>
where P: Freeze, M: Freeze, PhantomData<fn() -> B>: Freeze,

§

impl<B, P, M> RefUnwindSafe for SqlxLowerer<B, P, M>

§

impl<B, P, M> Send for SqlxLowerer<B, P, M>
where P: Send, M: Send, PhantomData<fn() -> B>: Send,

§

impl<B, P, M> Sync for SqlxLowerer<B, P, M>
where P: Sync, M: Sync, PhantomData<fn() -> B>: Sync,

§

impl<B, P, M> Unpin for SqlxLowerer<B, P, M>
where P: Unpin, M: Unpin, PhantomData<fn() -> B>: Unpin,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more