/// A parsed `SELECT-FROM-WHERE` statement in the current SQL subset. #[derive(Debug, Clone, PartialEq, Eq)] pub struct Select { /// Output expressions requested by the query. pub projection: Vec, /// Source tables and their optional aliases. pub from: Vec, /// Optional filter predicate. pub selection: Option, } /// One source entry in a `FROM` list. #[derive(Debug, Clone, PartialEq, Eq)] pub struct TableRef { /// The predicate-backed table name. pub name: String, /// Optional table alias used for qualification. pub alias: Option, } /// One item in a `SELECT` projection list. #[derive(Debug, Clone, PartialEq, Eq)] pub enum SelectItem { /// `*` Wildcard, /// A projected expression, optionally renamed with `AS`. Expr { expr: Expr, alias: Option }, } /// A SQL expression in the current subset. #[derive(Debug, Clone, PartialEq, Eq)] pub enum Expr { /// A column reference. Identifier(String), /// A literal value. Literal(Literal), /// A binary expression. Binary { left: Box, op: BinaryOp, right: Box, }, } /// A SQL literal in the current subset. #[derive(Debug, Clone, PartialEq, Eq)] pub enum Literal { /// A string literal. String(String), /// The `NULL` literal. Null, } /// A binary operator in the current subset. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum BinaryOp { /// Equality. Eq, }