pub trait RelayDatabaseAdapter: DatabaseAdapter {
// Required method
fn execute_relay_page<'a>(
&'a self,
view: &'a str,
cursor_column: &'a str,
after: Option<CursorValue>,
before: Option<CursorValue>,
limit: u32,
forward: bool,
where_clause: Option<&'a WhereClause>,
order_by: Option<&'a [OrderByClause]>,
include_total_count: bool,
) -> impl Future<Output = Result<RelayPageResult>> + Send + 'a;
// Provided method
fn execute_relay_page_with_session<'a>(
&'a self,
view: &'a str,
cursor_column: &'a str,
after: Option<CursorValue>,
before: Option<CursorValue>,
limit: u32,
forward: bool,
where_clause: Option<&'a WhereClause>,
order_by: Option<&'a [OrderByClause]>,
include_total_count: bool,
_session_vars: &'a [(&'a str, &'a str)],
) -> impl Future<Output = Result<RelayPageResult>> + Send + 'a { ... }
}Expand description
Database adapter supertrait for adapters that implement Relay cursor pagination.
Only adapters that genuinely support keyset pagination need to implement this trait. Non-implementing adapters carry no relay code at all — no stubs, no flags.
§Implementors
PostgresAdapter— full keyset paginationMySqlAdapter— keyset pagination with?paramsCachedDatabaseAdapter<A>— delegates to innerA
§Usage
Construct an Executor with Executor::new_with_relay to enable relay
query execution. The bound A: RelayDatabaseAdapter is enforced at that call site.
Required Methods§
Sourcefn execute_relay_page<'a>(
&'a self,
view: &'a str,
cursor_column: &'a str,
after: Option<CursorValue>,
before: Option<CursorValue>,
limit: u32,
forward: bool,
where_clause: Option<&'a WhereClause>,
order_by: Option<&'a [OrderByClause]>,
include_total_count: bool,
) -> impl Future<Output = Result<RelayPageResult>> + Send + 'a
fn execute_relay_page<'a>( &'a self, view: &'a str, cursor_column: &'a str, after: Option<CursorValue>, before: Option<CursorValue>, limit: u32, forward: bool, where_clause: Option<&'a WhereClause>, order_by: Option<&'a [OrderByClause]>, include_total_count: bool, ) -> impl Future<Output = Result<RelayPageResult>> + Send + 'a
Execute keyset (cursor-based) pagination against a JSONB view.
§Arguments
view— SQL view name (will be quoted before use)cursor_column— column used as the pagination key (e.g.pk_user,id)after— forward cursor: return rows wherecursor_column > afterbefore— backward cursor: return rows wherecursor_column < beforelimit— row fetch count (passpage_size + 1to detecthasNextPage)forward—true→ ASC order;false→ DESC (re-sorted ASC via subquery)where_clause— optional user-supplied filter applied after the cursor conditionorder_by— optional custom sort; cursor column appended as tiebreakerinclude_total_count— whentrue, compute the matching row count before LIMIT
§Errors
Returns FraiseQLError::Database on SQL execution failure.
Provided Methods§
Sourcefn execute_relay_page_with_session<'a>(
&'a self,
view: &'a str,
cursor_column: &'a str,
after: Option<CursorValue>,
before: Option<CursorValue>,
limit: u32,
forward: bool,
where_clause: Option<&'a WhereClause>,
order_by: Option<&'a [OrderByClause]>,
include_total_count: bool,
_session_vars: &'a [(&'a str, &'a str)],
) -> impl Future<Output = Result<RelayPageResult>> + Send + 'a
fn execute_relay_page_with_session<'a>( &'a self, view: &'a str, cursor_column: &'a str, after: Option<CursorValue>, before: Option<CursorValue>, limit: u32, forward: bool, where_clause: Option<&'a WhereClause>, order_by: Option<&'a [OrderByClause]>, include_total_count: bool, _session_vars: &'a [(&'a str, &'a str)], ) -> impl Future<Output = Result<RelayPageResult>> + Send + 'a
Connection-affine variant of execute_relay_page.
Applies session_vars transaction-locally on the same connection that
runs the page (and total-count) queries, so RLS-protected relay
pagination over views reading current_setting() returns the correct
tenant’s rows (fixes #329 for the cursor-pagination path).
Adapters that do not support session variables inherit the default,
which drops session_vars and delegates to execute_relay_page.
§Errors
Same errors as execute_relay_page;
additionally returns FraiseQLError::Database if set_config fails.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".