sqlgen 0.1.6

A library to generate SQL Statements.
Documentation
use crate::prelude::*;

#[derive(Debug, Error)]
pub enum SqlGenError {
    #[error("`{0}`")]
    MissingParts(String),
    #[error("`{0}`")]
    ParseFailed(String),
}

pub trait Sql {
    fn sql(&self, s: String, ctx: &Context) -> Result<String>;
}

pub trait Id: Debug + Sql {
    fn id(&self) -> usize;
}

pub(crate) type Result<T> = std::result::Result<T, SqlGenError>;

#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
#[derive(Debug)]
pub struct Context {}

impl Context {
    pub fn new() -> Self {
        Context {}
    }
}