| Crates.io | cstea |
| lib.rs | cstea |
| version | 2.0.1 |
| created_at | 2019-08-05 23:09:58.157347+00 |
| updated_at | 2020-01-11 02:29:58.062775+00 |
| description | An Ingredient crate for working with csv files in rettle. |
| homepage | |
| repository | https://github.com/slaterb1/cstea |
| max_upload_size | |
| id | 154416 |
| size | 39,592 |
This is a generic csv file Fill and Pour Ingredient crate for use with the rettle ETL.
#[derive(Default, Clone, Debug, Deserialize, Serialize)]
struct CsTea {
id: i32,
name: String,
value: i32
}
impl Tea for CsTea {
fn as_any(&self) -> &dyn Any {
self
}
}
fn main() {
let test_csvarg = FillCsvArg::new("fixtures/test.csv", 50);
let test_pour_csvarg = PourCsvArg::new("fixtures/pour.csv");
let brewery = Brewery::new(4, Instant::now());
let mut new_pot = Pot::new();
let fill_cstea = FillCsTea::new::<CsTea>("csv_tea_source", "csv_fixture", test_csvarg);
let pour_cstea = PourCsTea::new::<CsTea>("csv_pour_test", test_pour_csvarg);
new_pot = new_pot.add_source(fill_cstea);
// Steep operations of choice
new_pot = new_pot.add_ingredient(pour_cstea);
new_pot.brew(&brewery);
}