mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-04-05 02:49:32 +00:00
Introduce a lowerEq operator to the query builder
This commit is contained in:
parent
0be89687dc
commit
623a61dbb6
@ -164,6 +164,9 @@ 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 =
|
||||
Condition.CompareVal(col, Operator.LowerEq, value)
|
||||
|
||||
def ====(value: String): Condition =
|
||||
Condition.CompareVal(col.asInstanceOf[Column[String]], Operator.Eq, value)
|
||||
|
||||
|
@ -5,6 +5,7 @@ sealed trait Operator
|
||||
object Operator {
|
||||
|
||||
case object Eq extends Operator
|
||||
case object LowerEq extends Operator
|
||||
case object Neq extends Operator
|
||||
case object Gt extends Operator
|
||||
case object Lt extends Operator
|
||||
|
@ -69,6 +69,8 @@ object ConditionBuilder {
|
||||
val colFrag = op match {
|
||||
case Operator.LowerLike =>
|
||||
lower(col)
|
||||
case Operator.LowerEq =>
|
||||
lower(col)
|
||||
case _ =>
|
||||
SelectExprBuilder.column(col)
|
||||
}
|
||||
@ -80,6 +82,8 @@ object ConditionBuilder {
|
||||
val dbfFrag = op match {
|
||||
case Operator.LowerLike =>
|
||||
lower(dbf)
|
||||
case Operator.LowerEq =>
|
||||
lower(dbf)
|
||||
case _ =>
|
||||
DBFunctionBuilder.build(dbf)
|
||||
}
|
||||
@ -89,6 +93,8 @@ object ConditionBuilder {
|
||||
val (c1Frag, c2Frag) = op match {
|
||||
case Operator.LowerLike =>
|
||||
(lower(c1), lower(c2))
|
||||
case Operator.LowerEq =>
|
||||
(lower(c1), lower(c2))
|
||||
case _ =>
|
||||
(SelectExprBuilder.column(c1), SelectExprBuilder.column(c2))
|
||||
}
|
||||
@ -131,6 +137,8 @@ object ConditionBuilder {
|
||||
op match {
|
||||
case Operator.Eq =>
|
||||
fr" ="
|
||||
case Operator.LowerEq =>
|
||||
fr" ="
|
||||
case Operator.Neq =>
|
||||
fr" <>"
|
||||
case Operator.Gt =>
|
||||
|
Loading…
x
Reference in New Issue
Block a user