A library that allows you to write queries in Scala with QDSL (Quoted Domain Specific Language). The queries then get executed in the query language of your choice (SQL, CQL, etc.).
Quill provides a Quoted Domain Specific Language (QDSL) to express queries in Scala and execute them in a target language. The library’s core is designed to support multiple target languages, currently featuring specializations for sql and cql.
- Boilerplate-free mapping. The database schema is mapped using simple case classes.
- Quoted DSL. Queries are defined inside a quote block. Quill parses each quoted block of code (quotation) at compile time and translates them to an internal Abstract Syntax Tree (AST)
- Compile-time query generation. The
Context.run
call reads the quotation’s AST and translates it to the target language at compile time, emitting the query string as a compilation message. As the query string is known at compile time, the runtime overhead is very low and similar to using the database driver directly. - Compile-time query validation. If configured, the query is verified against the database at compile time and the compilation fails if it is not valid. The query validation does not alter the database state.
Resources: