toasty_core/stmt/
order_by_expr.rs

1use super::{Direction, Expr};
2
3#[derive(Debug, Clone, PartialEq)]
4pub struct OrderByExpr {
5    /// The expression
6    pub expr: Expr,
7
8    /// Ascending or descending
9    pub order: Option<Direction>,
10}
11
12impl OrderByExpr {
13    /// Flips the direction by which the query is ordered.
14    pub fn reverse(&mut self) {
15        self.order = match self.order {
16            Some(Direction::Desc) => None,
17            _ => Some(Direction::Asc),
18        }
19    }
20}