Skip to main content

query

Function query 

Source
pub fn query<'exe, 'data, Q: QueryStrategy + GetLimitClause>(
    executor: impl Executor<'exe>,
    model: &str,
    columns: &[ColumnSelector<'data>],
    joins: &[JoinTable<'data, 'data>],
    conditions: Option<&Condition<'data>>,
    order_by_clause: &[OrderByEntry<'_>],
    limit: Option<Q::LimitOrOffset>,
    distinct: bool,
) -> Q::Result<'exe>
Expand description

Executes a simple SELECT query.

It is generic over a QueryStrategy which specifies how and how many rows to query.

Parameter:

  • model: Model to query.
  • columns: Columns to retrieve values from.
  • joins: Join tables expressions.
  • conditions: Optional conditions to apply.
  • order_by_clause: Columns to order the rows by.
  • limit: Optional limit / offset to apply to the query. Depending on the query strategy, this is either LimitClause (for All and Stream) or a simple u64 (for One and Optional).