use std::sync::Arc;
use futures::future::BoxFuture;
use crate::{
compiler::aggregation::OrderByClause,
db::{CursorValue, RelayDatabaseAdapter, WhereClause, traits::RelayPageResult},
error::Result,
};
pub(in crate::runtime::executor) trait RelayDispatch:
Send + Sync
{
#[allow(clippy::too_many_arguments)] 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)],
) -> BoxFuture<'a, Result<RelayPageResult>>;
}
pub(in crate::runtime::executor) struct RelayDispatchImpl<A: RelayDatabaseAdapter>(
pub(in crate::runtime::executor) Arc<A>,
);
impl<A: RelayDatabaseAdapter + Send + Sync + 'static> RelayDispatch for RelayDispatchImpl<A> {
#[allow(clippy::too_many_arguments)] 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)],
) -> BoxFuture<'a, Result<RelayPageResult>> {
Box::pin(self.0.execute_relay_page_with_session(
view,
cursor_column,
after,
before,
limit,
forward,
where_clause,
order_by,
include_total_count,
session_vars,
))
}
}