use tokio_postgres::types::ToSql;

pub struct QueryBindings<'a>(Vec<&'a (dyn ToSql + Sync)>);

impl<'a> QueryBindings<'a> {
    pub fn new() -> Self {
        return QueryBindings(Vec::with_capacity(8));
    }

    pub fn add(&mut self, arg: &'a (dyn 'a + ToSql + Sync)) -> usize {
        self.0.push(arg);

        return self.0.len();
    }

    pub fn as_ref(&self) -> &[&'a (dyn ToSql + Sync)] {
        return &self.0;
    }
}
