Crate diesel_order_with_direction

Crate diesel_order_with_direction 

Source
Expand description

§Diesel dynamic query ordering

This crate provides the OrderWithDirectionDsl trait for dynamic query ordering;

#[macro_use] extern crate diesel;
use diesel::mysql::Mysql;
use diesel::QueryDsl;
use diesel_order_with_direction::{OrderWithDirectionDsl, QueryOrderDirection};
table! {
    posts (id) {
        id -> Integer,
    }
}

let direction = QueryOrderDirection::Descending;

let query = posts::table
    .into_boxed::<Mysql>()
    .order_with_dir(direction, posts::id)
    .limit(5);

let query = posts::table
    .into_boxed::<Mysql>()
    .then_order_by_with_dir(direction, posts::id)
    .limit(5);

Enums§

QueryOrderDirection
The direction of the query ordering.

Traits§

OrderWithDirectionDsl
OrderableTuple

Type Aliases§

OrderMultipleWithDirection
Represent the return type of .order_multiple_with_dir
OrderWithDirection
Represent the return type of .order_with_dir
ThenOrderByWithDirection
Represent the return type of .then_order_by_with_dir