sql-orm-query 0.1.0

Query AST and builder primitives for sql-orm.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::expr::TableRef;
use sql_orm_core::{ColumnValue, Entity, Insertable};

#[derive(Debug, Clone, PartialEq)]
pub struct InsertQuery {
    pub into: TableRef,
    pub values: Vec<ColumnValue>,
}

impl InsertQuery {
    pub fn for_entity<E: Entity, I: Insertable<E>>(insertable: &I) -> Self {
        Self {
            into: TableRef::for_entity::<E>(),
            values: insertable.values(),
        }
    }
}