derive_sql/traits/
insert.rs1use super::*;
2
3pub trait InsertFlavoredStatement {
4 fn insert_stmt<C, R>(&self, conn: &C) -> Result<String>
5 where C: Connection<R>,
6 R: Row;
7}
8
9pub trait InsertStatement {
10 fn insert_stmt(&self) -> Result<String>;
11}
12
13impl<T> InsertFlavoredStatement for T
14where T: InsertStatement
15{
16 fn insert_stmt<C, R>(&self, _conn: &C) -> Result<String>
17 where C: Connection<R>,
18 R: Row,
19 {
20 InsertStatement::insert_stmt(self)
21 }
22}
23
24pub trait Insert<C, R, T>
25where C: Connection<R>,
26 R: Row,
27{
28 fn insert(&self, conn: &mut C, object: &T) -> Result<()>;
29}
30
31pub trait InsertMultiple<'a, C, R, T: 'a>
32where C: Connection<R>,
33 R: Row,
34{
35 fn insert_multiple<I>(&self, conn: &mut C, objects: I) -> Result<()>
36 where I: core::iter::IntoIterator<Item = &'a T>;
37}