//! Transformation pipeline system with declarative specifications //! //! Provides comprehensive data transformation capabilities. use crate::{DataRecord, Result}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; /// Transformation specification #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Transformation { pub id: String, pub transform_type: TransformationType, pub config: HashMap, } /// Types of transformations #[derive(Debug, Clone, Serialize, Deserialize)] pub enum TransformationType { Sql(String), Map, Filter, CustomFunction(String), } /// Transformation builder pub struct TransformationBuilder { transformation: Transformation, } /// Function signature for transformations pub type TransformFunction = fn(&DataRecord) -> Result; /// Transformation pipeline #[derive(Debug, Default)] pub struct TransformationPipeline { pub steps: Vec, } /// SQL transformation #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SqlTransformation { pub query: String, pub params: HashMap, } impl Transformation { #[must_use] pub fn sql(query: &str) -> Self { Self { id: uuid::Uuid::new_v4().to_string(), transform_type: TransformationType::Sql(query.to_string()), config: HashMap::new(), } } }