Scala libraries are really extensible

Squeryl has a set of built in operators such as ===, times, div and so on. But it did not have an ILIKE operator, even though LIKE operator was present. Luckily we have Scala to fix that:

implicit class RicherTypedExpression[A1,T1](s1: TypedExpression[A1,T1]) {
  def ilike[A2,T2 <: TOptionString](s2: TypedExpression[A2,T2])(implicit ev: CanCompare[T1,T2]) = new BinaryOperatorNodeLogicalBoolean(s1, s2, "ilike")
}
implicit def stringToRTE(s: String) = RicherTypedExpression(stringTEF.create(s))

That code in scope adds ILIKE operator over the string fields. And it only took me a couple of minutes to write that code. The same amount of time it took to fork Squeryl and add ilike() method straight in there. That is great and among the reasons why I love Scala.

P.S. I did send a pull request to add ilike() operator, of course.