wardenclyffe 0.1.1

A tiny Rust query engine that supports SQL-like filters, CSV scanning, projections, and a custom DSL powered by Pest.
Documentation
use csv::Reader;
use serde::Deserialize;

#[derive(Debug, Deserialize, Clone)]
pub struct Row {
    pub age: Option<u32>,
    pub name: Option<String>,
    pub country: Option<String>,
    pub salary: Option<u32>,
}

pub struct CsvSource {
    reader: Reader<std::fs::File>,
}

impl CsvSource {
    pub fn new(path: &str) -> Self {
        let reader = csv::Reader::from_path(path).unwrap();
        Self { reader }
    }

    pub fn rows(&mut self) -> impl Iterator<Item = Row> + '_ {
        self.reader.deserialize::<Row>().map(|r| r.unwrap())
    }
}