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

The direction of the query ordering.

Traits

Type Definitions

Represent the return type of .order_with_dir