score:0
Accepted answer
here is info from doc http://slick.typesafe.com/doc/3.0.0/queries.html#sorting-and-filtering
i guess you can find here what you want. the example from doc:
//building criteria using a "dynamic filter" e.g. from a webform.
val criteriacolombian = option("colombian")
val criteriaespresso = option("espresso")
val criteriaroast:option[string] = none
val q4 = coffees.filter { coffee =>
list(
criteriacolombian.map(coffee.name === _),
criteriaespresso.map(coffee.name === _),
criteriaroast.map(coffee.name === _) // not a condition as `criteriaroast` evaluates to `none`
).collect({case some(criteria) => criteria}).reduceleftoption(_ || _).getorelse(true:column[boolean])
}
Source: stackoverflow.com
Related Query
- Slick Plain SQL Query with Dynamic Conditions
- Dynamic query conditions Slick 3.0
- Dynamic query with optional where clauses using Slick 3
- better slick dynamic query coding style
- Dynamic query parameters in Slick (sorting)
- Build dynamic UPDATE query in Slick 3
- Slick dynamic optional query or OR filter
- How to execute dynamic query with sql""select c from T""".as[T] interpolation in slick
- Build dynamic query with Slick 2.1.0
- Slick Combining query conditions effeciently
- View SQL query in Slick
- Scala slick query where in list
- Slick 3.0.0: How to query one-to-many / many-to-many relations
- Optimizing Slick generated SQL query
- How to write dynamic SQL queries with sql""" interpolation in slick
- scala slick query return value
- Slick - Compiled with dynamic sortBy
- Scala slick query comparison of a custom user type (enumeration) gives error
- How to specify SLICK Query sortBy column from runtime parameter?
- How to select max, min in same query in slick
- Printing interpolated SQL query in Slick
- Slick query with multiple joins, group by and having
- Why can't I use Options inside of a slick query
- Slick 3.0 many-to-many query with the join as an iterable
- Subtype for a table element in a Scala Slick Query
- Recursive tree-like table query with Slick
- How to work with and query dynamic column families in Phantom for Cassandra?
- Slick 3.0.0 - How to sortBy on a query with joinLeft
- Query one row with max value in one column in Slick
- combining slick queries into single query
More Query from same tag
- Can sbt be used to access a none-scala github repo to read into a scala project?
- why sparkcontext stopped?
- WithColumn and nulls, Scala Spark
- Scala with Spray Routing - accessing GET parameters?
- Scala: File object for testing (Resource?)
- How to avoid calling asInstanceOf in Scala with family polymorphism
- Iterating through Seq in Scala and find an element who satisfies the condition
- Scala Swing: Key events not firing?
- Joining Spark dataframes on the key
- How can I convert a unicode value to it's representation?
- Play Framework Asset Pipeline
- convert akka journal event columns string value to java object
- How to work around the immutable data frames in Spark/Scala?
- Conditional return from method in scala
- Play Framework: How to resize and convert to JPG an image after upload
- How do I use play framework 2's json path to parse json that has been poorly converted from xml?
- Dynamically build case class or schema
- Akka Flow hangs when making http requests via connection pool
- How to create an Akka Stream Source that generates items recursively
- scala, Jackson and @JsonTypeInfo
- Scala read csv file and sort the file
- Instantiating scala collections via their apply method with scala reflection
- Shapeless deconstruct tuple in type parameter declaration
- Case Class with higher order function in Parameter
- type mismatch error declaring list of classes
- When map over a function is useful when you have andThen
- Spark file load - `try` and `except` in scala
- Scala Sub string combinations with delimiter
- Get caller class and method name
- Scala-redis subscribes to * but receives zero messages