Skip to main content

query

Function query 

Source
pub fn query<'result, 'db: 'result, 'post_query: 'result, Q: QueryStrategy + GetLimitClause>(
    executor: impl Executor<'db>,
    model: &str,
    columns: &[ColumnSelector<'_>],
    joins: &[JoinTable<'_, 'post_query>],
    conditions: Option<&Condition<'post_query>>,
    order_by_clause: &[OrderByEntry<'_>],
    limit: Option<Q::LimitOrOffset>,
    distinct: bool,
) -> Q::Result<'result>
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).