ic_query_cli/presentation/report/
mod.rs1use crate::presentation::text_value::field;
4use ic_query::report::ReportProvenance;
5
6pub fn push_report_provenance_lines(lines: &mut Vec<String>, provenance: &ReportProvenance) {
8 lines.push(field("data_source", &(provenance.data_source())));
9 if let Some(cache_path) = provenance.cache_path() {
10 lines.push(field("cache_path", &cache_path));
11 lines.push("cache_complete: yes".to_string());
12 }
13}
14
15#[cfg(test)]
16mod tests;
17
18#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
25pub struct TextOptions {
26 pub verbose: bool,
28}
29
30pub fn refresh_attempt_lines(
32 attempt: &ic_query::cache::SnapshotRefreshAttemptStatus,
33) -> [String; 8] {
34 crate::presentation::text_value::report_fields!(attempt;
35 attempt_status = attempt.status,
36 attempt_started_at = &attempt.started_at,
37 attempt_updated_at = &attempt.updated_at,
38 attempt_page_size = attempt.page_size,
39 attempt_pages_fetched = attempt.pages_fetched,
40 attempt_rows_fetched = attempt.rows_fetched,
41 attempt_last_cursor = crate::presentation::text_value::optional_text(attempt.last_cursor.as_ref()),
42 attempt_last_error = crate::presentation::text_value::optional_text(attempt.last_error.as_ref()),
43 )
44}