1use crate::{Condition, TableInfo, selectable::Selectable};
2
3pub struct Update;
4pub struct Delete;
5pub struct SB<T, Stage> {
6 pub base: TableInfo,
8 pub fields: Option<Vec<&'static str>>,
10 pub filters: Vec<Condition>,
12 pub entity: T,
14 _marker: std::marker::PhantomData<Stage>,
15}
16impl<T> SB<T, Update> {
17 pub fn new(base: TableInfo, entity: T) -> SB<T, Update> {
18 SB {
19 base,
20 filters: Vec::new(),
21 fields: None,
22 entity,
23 _marker: std::marker::PhantomData,
24 }
25 }
26
27 pub fn columns(mut self, fields: impl Selectable) -> Self {
28 self.fields = Some(fields.collect());
29 self
30 }
31
32 pub fn filter(mut self, cond: Condition) -> Self {
33 self.filters.push(cond);
34 self
35 }
36}