tests_fuzz/ir/
select_expr.rs

1// Copyright 2023 Greptime Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use std::fmt::Display;
16
17use crate::ir::Column;
18
19pub enum Direction {
20    Asc,
21    Desc,
22}
23
24impl Display for Direction {
25    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
26        match self {
27            Direction::Asc => write!(f, "ASC"),
28            Direction::Desc => write!(f, "DESC"),
29        }
30    }
31}
32
33pub struct SelectExpr {
34    pub table_name: String,
35    pub columns: Vec<Column>,
36    pub order_by: Vec<String>,
37    pub direction: Direction,
38    pub limit: usize,
39}