hamelin_sql 0.3.10

SQL generation utilities for Hamelin query language
Documentation
//! Translation implementations for comparison operators

use crate::utils::direct_binary_operator_translation;
use crate::TranslationRegistry;
use hamelin_lib::func::defs::{
    BooleanEq, BooleanNeq, IntervalEq, IntervalGt, IntervalGte, IntervalLt, IntervalLte,
    IntervalNeq, Is, IsNot, NumericEq, NumericGt, NumericGte, NumericLt, NumericLte, NumericNeq,
    StringEq, StringNeq, TimestampEq, TimestampGt, TimestampGte, TimestampLt, TimestampLte,
    TimestampNeq,
};

/// Register all comparison operator translations.
pub fn register(registry: &mut TranslationRegistry) {
    // All comparison operators use direct binary operator translation
    // Timestamp
    registry.register::<TimestampEq>(direct_binary_operator_translation);
    registry.register::<TimestampNeq>(direct_binary_operator_translation);
    registry.register::<TimestampLt>(direct_binary_operator_translation);
    registry.register::<TimestampLte>(direct_binary_operator_translation);
    registry.register::<TimestampGt>(direct_binary_operator_translation);
    registry.register::<TimestampGte>(direct_binary_operator_translation);

    // Interval
    registry.register::<IntervalEq>(direct_binary_operator_translation);
    registry.register::<IntervalNeq>(direct_binary_operator_translation);
    registry.register::<IntervalLt>(direct_binary_operator_translation);
    registry.register::<IntervalLte>(direct_binary_operator_translation);
    registry.register::<IntervalGt>(direct_binary_operator_translation);
    registry.register::<IntervalGte>(direct_binary_operator_translation);

    // Boolean
    registry.register::<BooleanEq>(direct_binary_operator_translation);
    registry.register::<BooleanNeq>(direct_binary_operator_translation);

    // String
    registry.register::<StringEq>(direct_binary_operator_translation);
    registry.register::<StringNeq>(direct_binary_operator_translation);

    // Numeric
    registry.register::<NumericEq>(direct_binary_operator_translation);
    registry.register::<NumericNeq>(direct_binary_operator_translation);
    registry.register::<NumericLt>(direct_binary_operator_translation);
    registry.register::<NumericLte>(direct_binary_operator_translation);
    registry.register::<NumericGt>(direct_binary_operator_translation);
    registry.register::<NumericGte>(direct_binary_operator_translation);

    // IS / IS NOT
    registry.register::<Is>(direct_binary_operator_translation);
    registry.register::<IsNot>(direct_binary_operator_translation);
}