Skip to main content

partiql/sql/
sql.rs

1use std::str::FromStr;
2
3use crate::parser;
4pub use crate::sql::clause::Limit;
5pub use crate::sql::clause::OrderBy;
6use crate::sql::Field;
7pub use crate::sql::WhereCond;
8
9#[derive(Debug, Default, Clone, PartialEq)]
10pub struct Sql {
11    pub select_clause: Vec<Field>,
12    pub from_clause: Vec<Field>,
13    pub left_join_clause: Vec<Field>,
14    pub where_clause: Option<Box<WhereCond>>,
15    pub orderby: Option<OrderBy>,
16    pub limit: Option<Limit>,
17}
18
19impl FromStr for Sql {
20    type Err = anyhow::Error;
21
22    fn from_str(s: &str) -> anyhow::Result<Self> {
23        parser::select_statement::from_str(s)
24    }
25}