deltalens 2.2.0

Standalone CLI to inspect Delta Lake tables without Spark, JVM, or Python
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::error::DeltaLensError;
use serde::Serialize;
use std::io::Write;

/// Render any serializable structure as pretty JSON to stdout.
pub fn render_json<T: Serialize>(value: &T) -> Result<(), DeltaLensError> {
    let mut stdout = std::io::stdout().lock();
    write_json(&mut stdout, value)
}

/// Write any serializable structure as pretty JSON to an arbitrary `Write` sink.
pub fn write_json<W: Write, T: Serialize>(w: &mut W, value: &T) -> Result<(), DeltaLensError> {
    let json_str = serde_json::to_string_pretty(value)?;
    writeln!(w, "{json_str}")?;
    Ok(())
}