Fix tag category search being case insensitive

This commit is contained in:
eikek 2021-06-03 21:44:55 +02:00
parent 408a3eba3e
commit c2170d2daf

View File

@ -147,6 +147,15 @@ trait DSL extends DoobieMeta {
if (cs.isEmpty) c
else and(c, cs: _*)
implicit final class StringColumnOps(col: Column[String]) {
def lowerEq(value: String): Condition =
Condition.CompareVal(col, Operator.LowerEq, value.toLowerCase)
def like(value: String): Condition =
Condition.CompareVal(col, Operator.LowerLike, value.toLowerCase)
}
implicit final class ColumnOps[A](col: Column[A]) {
def s: SelectExpr =
SelectExpr.SelectColumn(col, None)
@ -176,13 +185,13 @@ trait DSL extends DoobieMeta {
def ===(value: A)(implicit P: Put[A]): Condition =
Condition.CompareVal(col, Operator.Eq, value)
def lowerEq(value: A)(implicit P: Put[A]): Condition =
def lowerEqA(value: A)(implicit P: Put[A]): Condition =
Condition.CompareVal(col, Operator.LowerEq, value)
def ====(value: String): Condition =
Condition.CompareVal(col.cast[String], Operator.Eq, value)
def like(value: A)(implicit P: Put[A]): Condition =
def likeA(value: A)(implicit P: Put[A]): Condition =
Condition.CompareVal(col, Operator.LowerLike, value)
def likes(value: String): Condition =
@ -215,10 +224,16 @@ trait DSL extends DoobieMeta {
def notIn(values: Nel[A])(implicit P: Put[A]): Condition =
in(values).negate
def inLower(values: Nel[A])(implicit P: Put[A]): Condition =
def inLower(values: Nel[String]): Condition =
Condition.InValues(col.s, values.map(_.toLowerCase), true)
def inLowerA(values: Nel[A])(implicit P: Put[A]): Condition =
Condition.InValues(col.s, values, true)
def notInLower(values: Nel[A])(implicit P: Put[A]): Condition =
def notInLower(values: Nel[String]): Condition =
Condition.InValues(col.s, values.map(_.toLowerCase), true).negate
def notInLowerA(values: Nel[A])(implicit P: Put[A]): Condition =
Condition.InValues(col.s, values, true).negate
def isNull: Condition =