Skip to content

Commit

Permalink
add README.md
Browse files Browse the repository at this point in the history
Fixed: No need to add a sequence number to the file name if don't want to split file.
  • Loading branch information
goalzz85 committed Oct 30, 2023
1 parent 344c414 commit 03d657c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ struct Cli {
#[arg(short, long, default_value_t = false)]
gzip : bool,

///maximum size of each exported file is measured in MB. file will be sperated into multiple files with file size smaller than the file_size you have set.
///maximum size of data written to a single file is measured in MB. file will be splitted into multiple files with file size smaller than the file-data-size you have set.
#[arg(short = 's', long, default_value_t = 0)]
file_size : usize,
file_data_size : usize,
}

fn main() {
Expand Down Expand Up @@ -102,8 +102,8 @@ fn main() {

let mut export_writer : Box<dyn TiDBExportWriter>;
if cli.writer.unwrap().eq("csv") {
let file_size = cli.file_size * 1024 * 1024;
export_writer = Box::new(CsvWriter::new(table_info_opt.unwrap(), cli.export.unwrap().as_str(), file_size, cli.gzip));
let file_data_size = cli.file_data_size * 1024 * 1024;
export_writer = Box::new(CsvWriter::new(table_info_opt.unwrap(), cli.export.unwrap().as_str(), file_data_size, cli.gzip));
} else {
print!("not supoort writer!");
return;
Expand Down
4 changes: 3 additions & 1 deletion src/writer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ impl WriteWrap {

if let Some(stem) = path.file_stem().and_then(|s| s.to_str()) {
new_file_name = stem.to_owned();
new_file_name.push_str(&format!(".{:09}", file_num));
if file_num > 0 {
new_file_name.push_str(&format!(".{:09}", file_num));
}

if let Some(extension) = path.extension().and_then(|s| s.to_str()) {
new_file_name.push('.');
Expand Down

0 comments on commit 03d657c

Please sign in to comment.