Trait query_connector::ReadOperations
source · pub trait ReadOperations {
// Required methods
fn get_single_record<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
model: &'life1 Model,
filter: &'life2 Filter,
selected_fields: &'life3 FieldSelection,
relation_load_strategy: RelationLoadStrategy,
trace_id: Option<String>
) -> Pin<Box<dyn Future<Output = Result<Option<SingleRecord>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn get_many_records<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
model: &'life1 Model,
query_arguments: QueryArguments,
selected_fields: &'life2 FieldSelection,
relation_load_strategy: RelationLoadStrategy,
trace_id: Option<String>
) -> Pin<Box<dyn Future<Output = Result<ManyRecords>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_related_m2m_record_ids<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
from_field: &'life1 RelationFieldRef,
from_record_ids: &'life2 [SelectionResult],
trace_id: Option<String>
) -> Pin<Box<dyn Future<Output = Result<Vec<(SelectionResult, SelectionResult)>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn aggregate_records<'life0, 'life1, 'async_trait>(
&'life0 mut self,
model: &'life1 Model,
query_arguments: QueryArguments,
selections: Vec<AggregationSelection>,
group_by: Vec<ScalarFieldRef>,
having: Option<Filter>,
trace_id: Option<String>
) -> Pin<Box<dyn Future<Output = Result<Vec<AggregationRow>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Required Methods§
sourcefn get_single_record<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
model: &'life1 Model,
filter: &'life2 Filter,
selected_fields: &'life3 FieldSelection,
relation_load_strategy: RelationLoadStrategy,
trace_id: Option<String>
) -> Pin<Box<dyn Future<Output = Result<Option<SingleRecord>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn get_single_record<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, model: &'life1 Model, filter: &'life2 Filter, selected_fields: &'life3 FieldSelection, relation_load_strategy: RelationLoadStrategy, trace_id: Option<String> ) -> Pin<Box<dyn Future<Output = Result<Option<SingleRecord>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,
Gets a single record or None
back from the database.
- The
ModelRef
represents the datamodel and its relations. - The
Filter
defines what item we want back and is guaranteed to be defined to filter at most one item by the core. - The
FieldSelection
defines the values to be returned.
sourcefn get_many_records<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
model: &'life1 Model,
query_arguments: QueryArguments,
selected_fields: &'life2 FieldSelection,
relation_load_strategy: RelationLoadStrategy,
trace_id: Option<String>
) -> Pin<Box<dyn Future<Output = Result<ManyRecords>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_many_records<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, model: &'life1 Model, query_arguments: QueryArguments, selected_fields: &'life2 FieldSelection, relation_load_strategy: RelationLoadStrategy, trace_id: Option<String> ) -> Pin<Box<dyn Future<Output = Result<ManyRecords>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
Gets multiple records from the database.
- The
ModelRef
represents the datamodel and its relations. - The
QueryArguments
defines various constraints (see docs for detailed explanation). - The
FieldSelection
defines the fields (e.g. columns or document fields) to be returned as a projection of fields of the model it queries.
Retrieves pairs of IDs that belong together from a intermediate join table.
Given the field from parent, and the projections, return the given projections with the corresponding child projections fetched from the database. The IDs returned will be used to perform a in-memory join between two datasets.
sourcefn aggregate_records<'life0, 'life1, 'async_trait>(
&'life0 mut self,
model: &'life1 Model,
query_arguments: QueryArguments,
selections: Vec<AggregationSelection>,
group_by: Vec<ScalarFieldRef>,
having: Option<Filter>,
trace_id: Option<String>
) -> Pin<Box<dyn Future<Output = Result<Vec<AggregationRow>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn aggregate_records<'life0, 'life1, 'async_trait>( &'life0 mut self, model: &'life1 Model, query_arguments: QueryArguments, selections: Vec<AggregationSelection>, group_by: Vec<ScalarFieldRef>, having: Option<Filter>, trace_id: Option<String> ) -> Pin<Box<dyn Future<Output = Result<Vec<AggregationRow>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Aggregates records for a specific model based on the given selections.
Whether or not the aggregations can be executed in a single query or
requires multiple roundtrips to the underlying data source is at the
discretion of the implementing connector.
having
can only be a scalar filter. Relation elements can be safely ignored.