From 55a611a71226bad419f914e7b0548dc2959de2d2 Mon Sep 17 00:00:00 2001 From: Richard Chien Date: Tue, 9 Jan 2024 17:33:12 +0800 Subject: [PATCH] expose `OrderType::direction()` Signed-off-by: Richard Chien --- src/common/src/util/sort_util.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/src/util/sort_util.rs b/src/common/src/util/sort_util.rs index 6cfca150a4dcc..754d094d2eb7a 100644 --- a/src/common/src/util/sort_util.rs +++ b/src/common/src/util/sort_util.rs @@ -29,7 +29,7 @@ use crate::types::{DefaultOrdered, ToDatumRef}; /// Sort direction, ascending/descending. #[derive(PartialEq, Eq, Hash, Copy, Clone, Debug, Display, Default)] -enum Direction { +pub enum Direction { #[default] #[display("ASC")] Ascending, @@ -185,6 +185,10 @@ impl OrderType { Self::nulls_last(Direction::Descending) } + pub fn direction(&self) -> Direction { + self.direction + } + pub fn is_ascending(&self) -> bool { self.direction == Direction::Ascending }