pub trait Sort {
// Required method
fn to_sql(self) -> String;
}Expand description
SQL sort functions
Required Methods§
Sourcefn to_sql(self) -> String
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()
}
}
}