sqlload 0.91.0

SQL data loading tooling.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! A batch window's length on its own.

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

/// A window's length as people say it on its own: `7 days`, `1 hour`, or as written when it isn't whole days, hours or minutes.
pub fn window_span(step: std::time::Duration) -> String {
    whole_units(step).map_or_else(
        || humantime::format_duration(step).to_string(),
        |(count, unit)| match count {
            1 => format!("1 {unit}"),
            count => format!("{count} {unit}s"),
        },
    )
}