pub mod generator;
pub mod client_sql;
pub mod config;
pub mod map_schema;
pub use client_sql::{ClientSql, TabGoes};
pub use config::ConfigClient;
pub type Result<T> = anyhow::Result<T>;
pub use chrono;
pub use rust_decimal;
pub use uuid;
use polars::prelude::*;
impl TabGoes {
pub fn join_inner(mut self, other: TabGoes, cols: &[&str])-> Self{
let join_exprs: Vec<Expr> = cols.iter().map(|&c| col(c)).collect();
self.lazy= self.lazy.join(other.lazy, join_exprs.clone(), join_exprs, JoinArgs::new(JoinType::Inner));
self._files.extend(other._files);
self
}
pub fn join_outher(mut self, other: TabGoes, cols: &[&str])-> Self{
let join_exprs: Vec<Expr> = cols.iter().map(|&c| col(c)).collect();
self.lazy= self.lazy.join(other.lazy, join_exprs.clone(), join_exprs, JoinArgs::new(JoinType::Left));
self._files.extend(other._files);
self
}
pub fn union(mut self, other: TabGoes)->Result<Self>{
self.lazy = concat(&[self.lazy, other.lazy], UnionArgs::default())?;
self._files.extend(other._files);
Ok(self)
}
pub fn order(mut self, cols: &[&str])-> Self{
let exprs: Vec<Expr> = cols.iter().map(|&c| col(c)).collect();
self.lazy = self.lazy.select(&exprs);
self
}
pub fn print(&self)->Result<()>{
let df = self.lazy.clone().collect()?;
println!("{}", df);
Ok(())
}
pub fn filter<F>(mut self, predicate: F) -> Self
where F: FnOnce() -> Expr {
self.lazy = self.lazy.filter(predicate());
self
}
}