ferriorm_runtime/order.rs
1//! Ordering support for query results.
2//!
3//! Defines [`SortOrder`] (ascending / descending) and the `OrderByClause`
4//! trait that generated per-model `OrderByInput` enums implement. This allows
5//! query builders to chain `.order_by(...)` calls in a type-safe way.
6
7/// Sort direction.
8#[derive(Debug, Clone, Copy, PartialEq, Eq)]
9pub enum SortOrder {
10 Asc,
11 Desc,
12}
13
14impl SortOrder {
15 pub fn as_sql(&self) -> &'static str {
16 match self {
17 Self::Asc => "ASC",
18 Self::Desc => "DESC",
19 }
20 }
21}