Query DSL
The Query DSL guides build one type-safe query language in four parts. You write a filter once as ordinary Scala, and the same expression can be evaluated in memory, turned into SQL, extended with new SQL features, and finally assembled into full statements.
Read the parts in order. Each one builds on the expressions and code from the one before.
- Expressions builds query expressions over your domain types with reified optics: comparisons, boolean logic, arithmetic and string operations. You evaluate them against in-memory data.
- SQL Generation translates those expressions into
WHEREclauses,SELECTstatements and parameterized queries. - Extending the Expression Language adds SQL predicates the built-in language lacks, such as
IN,BETWEEN,IS NULLandLIKE, plus aggregate functions andCASE WHEN. - A Fluent SQL Builder wraps everything in a builder for
SELECT,UPDATE,INSERTandDELETEstatements.
The reference pages for the optics and schema types the DSL uses are in the reference.