1use std::marker::PhantomData;
2
3use sqlx::{Encode, Type};
4
5use crate::query::Order;
6
7#[derive(Clone, Debug, Default)]
8pub enum Condition {
9 #[default]
10 AND,
11 OR
12}
13
14#[derive(Clone, Debug)]
15pub struct Where {
16 pub column: Option<String>,
17 pub operator: Option<String>,
18 pub position: Option<Condition>,
19 pub group: Option<Box<Where>>
20}
21
22#[derive(Debug)]
23pub struct WhereGroup<'q, DB: sqlx::Database> {
24 pub queries: Vec<Where>,
25 _marker: PhantomData<DB>,
26 _life: PhantomData<&'q ()>
27}
28
29impl <'q, DB>WhereGroup<'q, DB>
30where
31 DB: sqlx::Database
32{
33 pub fn new() -> Self {
34 return Self {
35 queries: Vec::new(),
36 _marker: PhantomData,
37 _life: PhantomData
38 }
39 }
40
41 pub fn r#where<T: 'q + Encode<'q, DB> + Type<DB>>(&mut self, _column: &str, _operator: &str, _val: T) -> &mut Self {
42 todo!()
43 }
44}
45
46
47#[derive(Clone, Debug)]
48pub struct OrderQuery {
49 pub column: String,
50 pub order: Order
51}
52
53#[derive(Clone, Debug, Default)]
54pub enum JoinType {
55 InnerJoin,
56 #[default]
57 LeftJoin,
58 RightJoin,
59 FullOuterJoin,
60 CrossJoin
61}
62
63#[derive(Clone, Debug, Default)]
64pub struct Join {
65 pub table: String,
66 pub column: String,
67 pub operator: String,
68 pub column_table: String,
69 pub join_type: JoinType
70}