sqlload 0.91.0

SQL data loading tooling.
1
2
3
4
5
6
7
8
9
10
11
//! A batch window's length before a noun.

use crate::time_text::_helpers::units::whole_units;

/// A window's length as people say it before a noun: `30-day`, `6-hour`, or as written when it isn't whole days, hours or minutes.
pub fn window_length(step: std::time::Duration) -> String {
    whole_units(step).map_or_else(
        || humantime::format_duration(step).to_string(),
        |(count, unit)| format!("{count}-{unit}"),
    )
}