pub struct ScopedQuery<Q> { /* private fields */ }Expand description
A query that is always scoped to a namespace
This type makes cross-workspace queries impossible by construction. Every query MUST specify a namespace scope.
Implementations§
Source§impl<Q> ScopedQuery<Q>
impl<Q> ScopedQuery<Q>
Sourcepub fn new(scope: NamespaceScope, query: Q) -> Self
pub fn new(scope: NamespaceScope, query: Q) -> Self
Create a new scoped query
The namespace scope is required - this is the key invariant.
Sourcepub fn in_namespace(namespace: Namespace, query: Q) -> Self
pub fn in_namespace(namespace: Namespace, query: Q) -> Self
Create a single-namespace query (convenience)
Sourcepub fn with_filters(self, filters: FilterIR) -> Self
pub fn with_filters(self, filters: FilterIR) -> Self
Add user filters
Sourcepub fn scope(&self) -> &NamespaceScope
pub fn scope(&self) -> &NamespaceScope
Get the namespace scope
Sourcepub fn effective_filter(&self) -> FilterIR
pub fn effective_filter(&self) -> FilterIR
Compute the effective filter (namespace + user filters)
This is the filter that will be passed to executors.
Sourcepub fn validate(&self, auth: &AuthScope) -> Result<(), ScopeError>
pub fn validate(&self, auth: &AuthScope) -> Result<(), ScopeError>
Validate this query against an auth scope
Sourcepub fn into_query(self) -> Q
pub fn into_query(self) -> Q
Extract the query, consuming self
Trait Implementations§
Source§impl<Q: Clone> Clone for ScopedQuery<Q>
impl<Q: Clone> Clone for ScopedQuery<Q>
Source§fn clone(&self) -> ScopedQuery<Q>
fn clone(&self) -> ScopedQuery<Q>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<Q> Freeze for ScopedQuery<Q>where
Q: Freeze,
impl<Q> RefUnwindSafe for ScopedQuery<Q>where
Q: RefUnwindSafe,
impl<Q> Send for ScopedQuery<Q>where
Q: Send,
impl<Q> Sync for ScopedQuery<Q>where
Q: Sync,
impl<Q> Unpin for ScopedQuery<Q>where
Q: Unpin,
impl<Q> UnsafeUnpin for ScopedQuery<Q>where
Q: UnsafeUnpin,
impl<Q> UnwindSafe for ScopedQuery<Q>where
Q: UnwindSafe,
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
Mutably borrows from an owned value. Read more
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>
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 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>
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