use sea_query::BinOper;

/// ClickHouse-specific binary operators.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum ChBinOper {
    /// `->`. Retrieves JSON field as JSON value.
    GetJsonField,
    /// `->>`. Retrieves JSON field and casts it to text.
    CastJsonField,
}

impl From<ChBinOper> for BinOper {
    fn from(o: ChBinOper) -> Self {
        match o {
            ChBinOper::GetJsonField => BinOper::Custom("->"),
            ChBinOper::CastJsonField => BinOper::Custom("->>"),
        }
    }
}
