Sort

Trait Sort 

Source
pub trait Sort {
    // Required method
    fn to_sql(self) -> String;
}
Expand description

SQL sort functions

Required Methods§

Source

fn to_sql(self) -> String

Turns the implementing struct into a valid sql sequence

In case you are trying to implement the sort yourself, an implementation can look like this

use teil::Sort;

enum AccountSort {
    ByOwner,
    ByRichest
}

impl Sort for AccountSort {
    fn to_sql(self) -> String {
        match self {
            AccountSort::ByOwner => "owner ASC".to_string(),
            AccountSort::ByRichest => "balance DESC".to_string()
        }
    }
}

Implementations on Foreign Types§

Source§

impl Sort for ()

Implementors§