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