1
use std::{fmt::Debug, marker::PhantomData};
2

            
3
use crate::{
4
    bounds::QueryParameter,
5
    crud::{CrudOperations, Transaction},
6
    mapper::RowMapper,
7
};
8

            
9
/// Holds a sql sentence details
10
#[derive(Debug, Clone)]
11
pub struct Query<'a, T: CrudOperations<T> + Transaction<T> + RowMapper<T>> {
12
    pub sql: String,
13
    pub params: Vec<&'a dyn QueryParameter<'a>>,
14
    marker: PhantomData<T>,
15
}
16

            
17
impl<'a, T> Query<'a, T>
18
where
19
    T: CrudOperations<T> + Transaction<T> + RowMapper<T>,
20
{
21
30
    pub fn new(sql: String) -> Query<'a, T> {
22
30
        Self {
23
            sql,
24
30
            params: vec![],
25
            marker: PhantomData,
26
        }
27
30
    }
28
}