Search code examples
scalasqueryl

What's Squeryl syntax for exclusion (i.e. != )?


Doing a simple Squeryl database lookup, but trying to exclude a value. I've tried:

j.id not jobExclude and j.id != jobExclude

however the first triggers a compiler error and the second triggers a runtime error.

The whole transaction:

from(DB.jobs)(j =>
      where((j.startTime >= todayStart)
      and (j.startTime <= todayEnd)
      and (j.userId === userId)
      and (j.teamId === teamId)
      and (j.startOrder >= index)
      and (j.id not jobExclude))
      select (j)).toList

Thanks!


Solution

  • Courtesy of the Squeryl Groups:

    Not equals is <>

    so in the bigger picture:

    (job.id <> jobExclude)

    See http://squeryl.org/functions.html

    Credit https://groups.google.com/forum/?fromgroups#!topic/squeryl/Hw7iVyvLLNM