hinge 0.1.0

SQL-native ELT engine — dependency graph resolved automatically from FROM/JOIN clauses, parallel execution, single binary
Documentation
use crate::domain::Asset;

/// Error returned when an asset fails to execute against the database.
#[derive(Debug, thiserror::Error)]
pub enum ExecutorError {
    #[error("failed to run '{asset}': {message}")]
    Run { asset: String, message: String },
}

/// Executes a single SQL asset against a database.
///
/// Implement this trait to add support for a new database backend.
/// The built-in implementations are [`PostgresExecutor`], [`ClickHouseExecutor`],
/// [`DuckDbExecutor`], and [`SnowflakeExecutor`].
///
/// [`PostgresExecutor`]: crate::PostgresExecutor
/// [`ClickHouseExecutor`]: crate::ClickHouseExecutor
/// [`DuckDbExecutor`]: crate::DuckDbExecutor
/// [`SnowflakeExecutor`]: crate::SnowflakeExecutor
#[async_trait::async_trait]
pub trait Executor {
    /// Execute the SQL body of `asset` and materialise the result in the database.
    async fn run(&self, asset: &Asset) -> Result<(), ExecutorError>;
}