pub struct PgSiftQuery { /* private fields */ }Implementations§
Source§impl PgSiftQuery
impl PgSiftQuery
Sourcepub async fn buckets<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
requests: &[BucketRequest<E>],
) -> Result<Vec<BucketResult>, PgSearchError>where
E: SearchEntity,
pub async fn buckets<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
requests: &[BucketRequest<E>],
) -> Result<Vec<BucketResult>, PgSearchError>where
E: SearchEntity,
Executes bounded time-series or numeric buckets with the same filters and authorization scope as the source query.
Source§impl PgSiftQuery
impl PgSiftQuery
Sourcepub async fn diagnose<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
) -> Result<QueryDiagnosticReport, PgSearchError>where
E: SearchEntity,
pub async fn diagnose<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
) -> Result<QueryDiagnosticReport, PgSearchError>where
E: SearchEntity,
Returns parameterized SQL, PostgreSQL JSON plans, and conservative index hints for an already authorized query. Callers should expose this admin-only operation behind their own authorization boundary.
Source§impl PgSiftQuery
impl PgSiftQuery
pub async fn search_list<E>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, ) -> Result<Vec<E>, PgSearchError>
pub async fn search_first<E>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, ) -> Result<Option<E>, PgSearchError>
pub async fn count<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
) -> Result<i64, PgSearchError>where
E: SearchEntity,
pub async fn sum<E, T, K>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, field: FieldRef<E, T, K>, ) -> Result<Option<<T as PgSumType>::Output>, PgSearchError>
Source§impl PgSiftQuery
impl PgSiftQuery
pub fn new(pool: Pool<Postgres>) -> PgSiftQuery
pub fn with_policy( pool: Pool<Postgres>, policy: QueryPolicy, execution: PgExecutionPolicy, ) -> Result<PgSiftQuery, ConfigError>
pub fn shape_cache_stats(&self) -> Option<ShapeCacheStats>
pub fn clear_shape_cache(&self)
Sourcepub fn with_scan_concurrency(
self,
active: usize,
waiting: usize,
) -> Result<PgSiftQuery, ConfigError>
pub fn with_scan_concurrency( self, active: usize, waiting: usize, ) -> Result<PgSiftQuery, ConfigError>
Configures a separate active/waiting scan budget shared by instance clones.
pub fn with_partition_resolver<R>(self, resolver: R) -> PgSiftQuerywhere
R: PartitionResolver + 'static,
pub fn with_sql_interceptor<I>(self, interceptor: I) -> PgSiftQuerywhere
I: SqlInterceptor + 'static,
pub fn with_result_filter<F>(self, filter: F) -> PgSiftQuerywhere
F: ResultFilter + 'static,
pub fn with_page_enricher<E>(self, enricher: E) -> PgSiftQuerywhere
E: PageEnricher + 'static,
pub fn query_builder<E>(&self) -> QueryBuilder<'_, E>where
E: SearchEntity,
Source§impl PgSiftQuery
impl PgSiftQuery
Sourcepub async fn search_on<E>(
&self,
connection: &mut PgConnection,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
) -> Result<Page<E>, PgSearchError>
pub async fn search_on<E>( &self, connection: &mut PgConnection, query: impl QueryInput<E>, scope: &ServerScope<E>, ) -> Result<Page<E>, PgSearchError>
Executes a typed page in an existing connection or transaction.
Pass &mut *transaction for a sqlx transaction. This method does not
begin/commit/rollback transactions or modify statement_timeout.
Sourcepub async fn search_on_with<E>(
&self,
connection: &mut PgConnection,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
group_scope: &GroupScope<E>,
options: Option<&SearchOptions<E>>,
) -> Result<Page<E>, PgSearchError>
pub async fn search_on_with<E>( &self, connection: &mut PgConnection, query: impl QueryInput<E>, scope: &ServerScope<E>, group_scope: &GroupScope<E>, options: Option<&SearchOptions<E>>, ) -> Result<Page<E>, PgSearchError>
Typed external execution with server-owned HAVING and summaries.
Sourcepub async fn search_map_on<E>(
&self,
connection: &mut PgConnection,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
) -> Result<Page<IndexMap<String, RowValue>>, PgSearchError>where
E: SearchEntity,
pub async fn search_map_on<E>(
&self,
connection: &mut PgConnection,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
) -> Result<Page<IndexMap<String, RowValue>>, PgSearchError>where
E: SearchEntity,
Executes a dynamic map page on a caller-owned connection.
Sourcepub async fn search_map_on_with<E>(
&self,
connection: &mut PgConnection,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
group_scope: &GroupScope<E>,
options: Option<&SearchOptions<E>>,
) -> Result<Page<IndexMap<String, RowValue>>, PgSearchError>where
E: SearchEntity,
pub async fn search_map_on_with<E>(
&self,
connection: &mut PgConnection,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
group_scope: &GroupScope<E>,
options: Option<&SearchOptions<E>>,
) -> Result<Page<IndexMap<String, RowValue>>, PgSearchError>where
E: SearchEntity,
Dynamic external execution with server-owned HAVING and summaries.
Source§impl PgSiftQuery
impl PgSiftQuery
pub fn parse<E>(&self, raw: &RawParams) -> Result<UserQuery<E>, ParamError>where
E: SearchEntity,
Source§impl PgSiftQuery
impl PgSiftQuery
Sourcepub async fn search_as_cursor<E, P>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
) -> Result<CursorPage<P>, PgSearchError>
pub async fn search_as_cursor<E, P>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, ) -> Result<CursorPage<P>, PgSearchError>
Executes a static typed projection as a cursor page without a count.
pub async fn search_as<E, P>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, ) -> Result<Page<P>, PgSearchError>
pub async fn search_as_with<E, P>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, options: &SearchOptions<E>, ) -> Result<Page<P>, PgSearchError>
Source§impl PgSiftQuery
impl PgSiftQuery
Sourcepub async fn search_cursor<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
) -> Result<CursorPage<E>, PgSearchError>
pub async fn search_cursor<E>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, ) -> Result<CursorPage<E>, PgSearchError>
Executes a cursor page with one bounded list query. The query must use
the cursor paging mode (cursor= for the first page); no COUNT or
summary query is issued.
Sourcepub async fn search_map_cursor<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
) -> Result<CursorPage<IndexMap<String, RowValue>>, PgSearchError>where
E: SearchEntity,
pub async fn search_map_cursor<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
) -> Result<CursorPage<IndexMap<String, RowValue>>, PgSearchError>where
E: SearchEntity,
Dynamic map equivalent of Self::search_cursor.
Executes a query after deriving its mandatory server scope from a trusted application context.
Dynamic map equivalent of Self::search_authorized.
Count equivalent of Self::search_authorized.
Sourcepub async fn search_enriched<E, R>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
enricher: &R,
) -> Result<Page<E>, PgSearchError>
pub async fn search_enriched<E, R>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, enricher: &R, ) -> Result<Page<E>, PgSearchError>
Runs typed page enrichment only when explicitly requested by the caller.
pub async fn search<E>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, ) -> Result<Page<E>, PgSearchError>
Sourcepub async fn search_with_group_scope<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
group_scope: &GroupScope<E>,
) -> Result<Page<E>, PgSearchError>
pub async fn search_with_group_scope<E>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, group_scope: &GroupScope<E>, ) -> Result<Page<E>, PgSearchError>
Executes a page with an additional server-owned HAVING scope.
pub async fn search_with<E>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, options: &SearchOptions<E>, ) -> Result<Page<E>, PgSearchError>
Sourcepub async fn search_typed_with_scopes<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
group_scope: &GroupScope<E>,
options: Option<&SearchOptions<E>>,
) -> Result<Page<E>, PgSearchError>
pub async fn search_typed_with_scopes<E>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, group_scope: &GroupScope<E>, options: Option<&SearchOptions<E>>, ) -> Result<Page<E>, PgSearchError>
Executes a typed page with both server scopes and optional summaries.
pub async fn search_map<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
) -> Result<Page<IndexMap<String, RowValue>>, PgSearchError>where
E: SearchEntity,
Sourcepub async fn search_map_with_group_scope<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
group_scope: &GroupScope<E>,
) -> Result<Page<IndexMap<String, RowValue>>, PgSearchError>where
E: SearchEntity,
pub async fn search_map_with_group_scope<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
group_scope: &GroupScope<E>,
) -> Result<Page<IndexMap<String, RowValue>>, PgSearchError>where
E: SearchEntity,
Executes a dynamic map page with an additional server-owned HAVING scope.
pub async fn search_map_with<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
options: &SearchOptions<E>,
) -> Result<Page<IndexMap<String, RowValue>>, PgSearchError>where
E: SearchEntity,
Sourcepub async fn search_map_with_scopes<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
group_scope: &GroupScope<E>,
options: Option<&SearchOptions<E>>,
) -> Result<Page<IndexMap<String, RowValue>>, PgSearchError>where
E: SearchEntity,
pub async fn search_map_with_scopes<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
group_scope: &GroupScope<E>,
options: Option<&SearchOptions<E>>,
) -> Result<Page<IndexMap<String, RowValue>>, PgSearchError>where
E: SearchEntity,
Executes a map page with both server scopes and optional summaries.
Source§impl PgSiftQuery
impl PgSiftQuery
Sourcepub fn search_stream<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
) -> Result<Pin<Box<dyn Stream<Item = Result<E, PgSearchError>> + Send>>, PgSearchError>
pub fn search_stream<E>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, ) -> Result<Pin<Box<dyn Stream<Item = Result<E, PgSearchError>> + Send>>, PgSearchError>
Streams a page without count. Early drop closes the checked-out connection so an active statement or timeout cannot return to the pool.
pub fn search_map_stream<E>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, ) -> Result<Pin<Box<dyn Stream<Item = Result<IndexMap<String, RowValue>, PgSearchError>> + Send>>, PgSearchError>
Sourcepub fn scan<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
policy: ScanPolicy,
) -> Result<Pin<Box<dyn Future<Output = Result<Vec<E>, PgSearchError>> + Send>>, PgSearchError>
pub fn scan<E>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, policy: ScanPolicy, ) -> Result<Pin<Box<dyn Future<Output = Result<Vec<E>, PgSearchError>> + Send>>, PgSearchError>
Explicit collecting convenience; prefer scan_stream for constant-memory use.
pub fn scan_stream<E>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, policy: ScanPolicy, ) -> Result<Pin<Box<dyn Stream<Item = Result<E, PgSearchError>> + Send>>, PgSearchError>
pub fn scan_map<E>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, policy: ScanPolicy, ) -> Result<Pin<Box<dyn Future<Output = Result<Vec<IndexMap<String, RowValue>>, PgSearchError>> + Send>>, PgSearchError>
pub fn scan_map_stream<E>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, policy: ScanPolicy, ) -> Result<Pin<Box<dyn Stream<Item = Result<IndexMap<String, RowValue>, PgSearchError>> + Send>>, PgSearchError>
pub fn scan_map_stream_with_scopes<E>( &self, query: impl QueryInput<E>, scope: &ServerScope<E>, group_scope: &GroupScope<E>, policy: ScanPolicy, ) -> Result<Pin<Box<dyn Stream<Item = Result<IndexMap<String, RowValue>, PgSearchError>> + Send>>, PgSearchError>
Source§impl PgSiftQuery
impl PgSiftQuery
Sourcepub async fn facets<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
requests: &[FacetRequest],
) -> Result<Vec<FacetResult>, PgSearchError>where
E: SearchEntity,
pub async fn facets<E>(
&self,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
requests: &[FacetRequest],
) -> Result<Vec<FacetResult>, PgSearchError>where
E: SearchEntity,
Executes bounded server-declared facets using the same query and row authorization scope. Facet fields and limits are validated before a connection is acquired.
Sourcepub async fn search_map_with_facets<E>(
&self,
query: impl QueryInput<E> + Clone,
scope: &ServerScope<E>,
requests: &[FacetRequest],
) -> Result<FacetPage<IndexMap<String, RowValue>>, PgSearchError>where
E: SearchEntity,
pub async fn search_map_with_facets<E>(
&self,
query: impl QueryInput<E> + Clone,
scope: &ServerScope<E>,
requests: &[FacetRequest],
) -> Result<FacetPage<IndexMap<String, RowValue>>, PgSearchError>where
E: SearchEntity,
Convenience operation for dynamic list pages with facets.
Sourcepub async fn facets_on<E>(
&self,
connection: &mut PgConnection,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
requests: &[FacetRequest],
) -> Result<Vec<FacetResult>, PgSearchError>where
E: SearchEntity,
pub async fn facets_on<E>(
&self,
connection: &mut PgConnection,
query: impl QueryInput<E>,
scope: &ServerScope<E>,
requests: &[FacetRequest],
) -> Result<Vec<FacetResult>, PgSearchError>where
E: SearchEntity,
Executes a facet on a caller-owned connection. This is useful when the caller has opened a read-only transaction and needs the list and facet queries to observe one snapshot.
Sourcepub async fn search_map_with_facets_on<E>(
&self,
connection: &mut PgConnection,
query: impl QueryInput<E> + Clone,
scope: &ServerScope<E>,
requests: &[FacetRequest],
) -> Result<FacetPage<IndexMap<String, RowValue>>, PgSearchError>where
E: SearchEntity,
pub async fn search_map_with_facets_on<E>(
&self,
connection: &mut PgConnection,
query: impl QueryInput<E> + Clone,
scope: &ServerScope<E>,
requests: &[FacetRequest],
) -> Result<FacetPage<IndexMap<String, RowValue>>, PgSearchError>where
E: SearchEntity,
Executes a map page and its facets on one caller-owned connection. Begin a read-only transaction before calling this method to obtain a consistent snapshot for both results.
Source§impl PgSiftQuery
impl PgSiftQuery
pub fn with_query_observer<O>(self, observer: O) -> PgSiftQuerywhere
O: QueryObserver + 'static,
pub fn with_slow_query_threshold(self, threshold: Duration) -> PgSiftQuery
pub fn with_entity_slow_query_threshold<E>(
self,
threshold: Duration,
) -> PgSiftQuerywhere
E: SearchEntity,
Source§impl PgSiftQuery
impl PgSiftQuery
Sourcepub async fn validate_schema<E>(
&self,
) -> Result<SchemaValidationReport, PgSearchError>where
E: SearchEntity,
pub async fn validate_schema<E>(
&self,
) -> Result<SchemaValidationReport, PgSearchError>where
E: SearchEntity,
Validates an entity’s source, projection, predicates, grouping and aliases by asking PostgreSQL to plan the generated query.
EXPLAIN plans the statement without reading result rows. This makes
the method suitable for application startup and CI contract checks;
it does not inspect information_schema and does not mutate the
database.
Trait Implementations§
Source§impl Clone for PgSiftQuery
impl Clone for PgSiftQuery
Source§fn clone(&self) -> PgSiftQuery
fn clone(&self) -> PgSiftQuery
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for PgSiftQuery
impl !UnwindSafe for PgSiftQuery
impl Freeze for PgSiftQuery
impl Send for PgSiftQuery
impl Sync for PgSiftQuery
impl Unpin for PgSiftQuery
impl UnsafeUnpin for PgSiftQuery
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