slick 2.0.2 Query.filter or Query.where support logical operation any more?

406 views
Skip to first unread message

Lu Sheng

unread,
May 26, 2014, 4:45:45 PM5/26/14
to scala...@googlegroups.com
I use slick 2.0.2,want just simple filter or use where sub-statement:

    val subjectdata = TableQuery[SubjectTable]
    ...
    subjectdata.where(i=>(i.id===id && i.userId===rs.user.get.identityId.userId)).list()

and get error:
   
    [error] G:\testprojects\slickplay\app\controllers\ShopController.scala:89: Cannot perform option-mapped operation
    [error]       with type: (Long, String) => R
    [error]   for base type: (Long, Long) => Boolean
    [error]     subjectdata.where(i=>(i.id===id && i.userId===rs.user.get.identityId
    .userId)).list()
    [error]
                                                                 ^

In slick 1.0.1 I can do:

    val results = Query(TableClass)
    .filter(r => r.isNull || r.expires > new Timestamp(DateTime.now().getMillis()))
    .list

I want do similar staff on TableQuery or Query in slick2, How to do it?

Pedro Furlanetto

unread,
May 26, 2014, 5:36:55 PM5/26/14
to scala...@googlegroups.com
http://stackoverflow.com/questions/23877451/slick-filter-or-where-support-logical-operation-any-more
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Slick / ScalaQuery" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to scalaquery+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/scalaquery/67cf0e46-89df-46a2-9a5f-de5b553bb5f2%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Christopher Vogt

unread,
May 26, 2014, 9:09:42 PM5/26/14
to scala...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages