query-forge 0.9.0

Run SQL queries and dataset diffs on XLSX/XML/CSV/JSON/JSONL/Markdown/HTML/Feather/Parquet inputs and export results as text, CSV, JSONL, Markdown, XML, HTML, XLSX, Feather, or Parquet
Documentation
use clap::ValueEnum;

#[derive(Clone, Debug, ValueEnum)]
pub(crate) enum OutputFormat {
    /// Human-readable aligned table format. Default when no other format is specified.
    Table,
    /// Alias for `table`, kept for backward compatibility.
    Text,
    Csv,
    Json,
    Jsonl,
    #[value(alias = "md")]
    Markdown,
    Html,
    Xlsx,
    Xml,
    Feather,
    Parquet,
}

#[derive(Clone, Debug, ValueEnum)]
pub(crate) enum InspectionFormat {
    Text,
    Json,
    #[value(alias = "md")]
    Markdown,
}

#[derive(Clone, Debug, ValueEnum)]
pub(crate) enum MetadataFormat {
    /// Human-readable text output (default).
    Text,
    /// Machine-readable JSON output.
    Json,
}

#[derive(Clone, Debug, ValueEnum)]
pub(crate) enum HeaderCase {
    Snake,
    Camel,
    Pascal,
    ScreamingSnake,
}

/// JSON extraction mode for `--json-mode`.
#[derive(Clone, Debug, ValueEnum)]
pub(crate) enum JsonMode {
    /// Each element of a top-level JSON array becomes a row (default).
    Array,
    /// Each key-value pair of the JSON object becomes a row with "key" and "value" columns.
    Object,
    /// Recursively flatten nested JSON into dotted key paths (e.g. address.city).
    Flatten,
}

/// XML extraction mode for `--xml-mode`.
#[derive(Clone, Debug, ValueEnum)]
pub(crate) enum XmlMode {
    /// Detect and extract tabular rows from the XML structure (default).
    Rows,
    /// Collect every leaf text element as a row with "tag" and "value" columns.
    Descendants,
    /// Extract element attributes as columns; each element with attributes becomes a row.
    Attributes,
}

/// Aggregation function for `qf pivot`.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) enum PivotAggregation {
    /// Count rows (or non-NULL values when a value column is provided).
    Count,
    /// Sum numeric values.
    Sum,
    /// Average numeric values.
    Avg,
    /// Minimum value.
    Min,
    /// Maximum value.
    Max,
}