| 1 |
use crate::query_builder::*; |
| 2 |
use crate::query_source::Column; |
| 3 |
|
| 4 |
/// Represents the column list for use in an insert statement. |
| 5 |
/// |
| 6 |
/// This trait is implemented by columns and tuples of columns. |
| 7 |
pub trait ColumnList { |
| 8 |
/// The table these columns belong to |
| 9 |
type Table; |
| 10 |
|
| 11 |
/// Generate the SQL for this column list. |
| 12 |
/// |
| 13 |
/// Column names must *not* be qualified. |
| 14 |
fn walk_ast<DB: Backend>(&self, out: AstPass<'_, '_, DB>) -> QueryResult<()>; |
| 15 |
} |
| 16 |
|
| 17 |
impl<C> ColumnList for C |
| 18 |
where |
| 19 |
C: Column, |
| 20 |
{ |
| 21 |
type Table = <C as Column>::Table; |
| 22 |
|
| 23 |
fn walk_ast<DB: Backend>(&self, mut out: AstPass<'_, '_, DB>) -> QueryResult<()> { |
| 24 |
out.push_identifier(C::NAME)?; |
| 25 |
Ok(()) |
| 26 |
} |
| 27 |
} |