Start adding row-level splitting, refactor cli and graph into subcrates

This commit is contained in:
2024-08-09 22:13:43 +09:30
parent 3cdaa81da1
commit 0ee88e3a99
11 changed files with 259 additions and 110 deletions

View File

@@ -10,13 +10,15 @@ use std::io::Write;
use clap::{command, Parser};
pub use commands::Commands;
use coster_rs::{
use log::info;
use schemars::schema_for;
use crate::{
create_products::InputFile,
graph::{Graph, RunnableGraph},
SourceType,
};
use log::info;
use schemars::schema_for;
mod commands;
@@ -41,7 +43,7 @@ impl Cli {
output,
use_numeric_accounts,
flush_pass,
} => coster_rs::move_money(
} => crate::move_money(
&mut csv::Reader::from_path(rules)?,
&mut csv::Reader::from_path(lines)?,
&mut csv::Reader::from_path(accounts)?,
@@ -66,7 +68,7 @@ impl Cli {
} => {
if msgpack_serialisation {
let mut file = BufWriter::new(File::create(output)?);
coster_rs::reciprocal_allocation(
crate::reciprocal_allocation(
&mut csv::Reader::from_path(lines)?,
&mut csv::Reader::from_path(accounts)?,
&mut csv::Reader::from_path(allocation_statistics)?,
@@ -81,7 +83,7 @@ impl Cli {
zero_threshold,
)
} else {
coster_rs::reciprocal_allocation(
crate::reciprocal_allocation(
&mut csv::Reader::from_path(lines)?,
&mut csv::Reader::from_path(accounts)?,
&mut csv::Reader::from_path(allocation_statistics)?,
@@ -165,7 +167,7 @@ impl Cli {
date_order_column: None,
},
);
coster_rs::create_products::create_products_polars(definitions, vec![], output)
crate::create_products::create_products_polars(definitions, vec![], output)
}
Commands::RunGraph { graph, threads } => {
let file = File::open(graph)?;