pub mod cache;
pub mod config;
pub mod query;
pub mod trino;
pub mod types;
pub use cache::{cache_dir, cache_stats, clear_cache, purge_old_cache, CacheStats};
pub use config::Config;
pub use query::{build_history_query, build_flightlist_query, build_rawdata_query, build_query_preview, build_query_preview_method};
pub use trino::{QueryStatus, Trino};
pub use types::{Bounds, FlightData, OpenSkyError, QueryParams, RawTable, Result, FLIGHT_COLUMNS, FLIGHTLIST_COLUMNS, RAWDATA_COLUMNS};
pub use polars::frame::DataFrame;
use std::path::Path;
pub fn write_csv(df: &DataFrame, path: impl AsRef<Path>) -> Result<()> {
use polars::prelude::*;
let mut file = std::fs::File::create(path.as_ref())?;
CsvWriter::new(&mut file)
.finish(&mut df.clone())
.map_err(|e| OpenSkyError::DataConversion(format!("Failed to write CSV: {}", e)))?;
Ok(())
}
pub fn write_parquet(df: &DataFrame, path: impl AsRef<Path>) -> Result<()> {
use polars::prelude::*;
let mut file = std::fs::File::create(path.as_ref())?;
ParquetWriter::new(&mut file)
.finish(&mut df.clone())
.map_err(|e| OpenSkyError::DataConversion(format!("Failed to write Parquet: {}", e)))?;
Ok(())
}