use crate::values::PostgresValue;
use drizzle_core::expr::{Expr, NonNull, SQLExpr, Scalar};
use drizzle_core::sql::{SQL, SQLChunk, Token};
use drizzle_types::postgres::types::Boolean;
pub fn ilike<'a, E, P>(
expr: E,
pattern: P,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>
where
E: Expr<'a, PostgresValue<'a>>,
P: Into<PostgresValue<'a>>,
{
SQLExpr::new(
expr.to_sql()
.push(SQLChunk::Raw("ILIKE".into()))
.append(SQL::param(pattern.into())),
)
}
pub fn not_ilike<'a, E, P>(
expr: E,
pattern: P,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>
where
E: Expr<'a, PostgresValue<'a>>,
P: Into<PostgresValue<'a>>,
{
SQLExpr::new(
expr.to_sql()
.push(Token::NOT)
.push(SQLChunk::Raw("ILIKE".into()))
.append(SQL::param(pattern.into())),
)
}