vantage-sql 0.4.6

Vantage extension for SQL databases (Postgres, MySQL, SQLite)
Documentation
//! SqliteOperation trait — vendor-specific comparison operations producing
//! `SqliteCondition`. Generated by `define_sql_operation!` in `condition.rs`.

use crate::condition::SqliteCondition;
use crate::define_sql_operation;

define_sql_operation!(
    SqliteOperation,
    SqliteCondition,
    crate::sqlite::types::AnySqliteType
);

#[cfg(test)]
mod tests {
    use super::*;
    use crate::sqlite::types::AnySqliteType;
    use vantage_table::column::core::Column;

    #[test]
    fn test_column_eq() {
        let name = Column::<AnySqliteType>::new("name");
        let cond = name.eq(AnySqliteType::from("Alice".to_string()));
        assert_eq!(cond.into_expr().preview(), "name = 'Alice'");
    }

    #[test]
    fn test_typed_column_gt() {
        let price = Column::<i64>::new("price");
        let cond = price.gt(150i64);
        assert_eq!(cond.into_expr().preview(), "price > 150");
    }

    #[test]
    fn test_chaining_gt_eq_false() {
        let price = Column::<i64>::new("price");
        let cond = price.gt(10i64).eq(false);
        assert_eq!(cond.into_expr().preview(), "price > 10 = 0");
    }

    #[test]
    fn test_chaining_gt_eq_true() {
        let price = Column::<i64>::new("price");
        let cond = price.gt(10i64).eq(true);
        assert_eq!(cond.into_expr().preview(), "price > 10 = 1");
    }

    #[test]
    fn test_typed_bool_column() {
        let is_deleted = Column::<bool>::new("is_deleted");
        let cond = is_deleted.eq(false);
        assert_eq!(cond.into_expr().preview(), "is_deleted = 0");
    }

    #[test]
    fn test_cross_type_rejected() {
        // price.gt(false) should NOT compile — bool isn't Expressive<i64>
        // This is a compile-time guarantee, not a runtime test.
        let price = Column::<i64>::new("price");
        let _: SqliteCondition = price.gt(150i64);
    }
}