zio-quill
Compile-time Language Integrated Queries for Scala
What is zio-quill?
Compile-time Language Integrated Queries for Scala
Overview of zio-quill
What it is
ZIO Quill is a compile-time Language Integrated Query (LINQ) library for Scala. It provides a Quoted Domain Specific Language (QDSL) that allows developers to express database queries in Scala and have them translated to a target language at compile time. The library currently supports specializations for SQL and Cassandra Query Language (CQL). It is part of the ZIO ecosystem and is open source under the Apache-2.0 license.
Key features
- Boilerplate-free mapping: Database schemas are mapped using simple case classes.
- Quoted DSL: Queries are defined inside a
quoteblock, which is parsed at compile time and translated to an internal Abstract Syntax Tree (AST). - Compile-time query generation: The
ctx.runcall translates the quotation's AST to the target language at compile time, emitting the query string as a compilation message. This results in low runtime overhead similar to using the database driver directly. - Compile-time query validation: If configured, the query is verified against the database at compile time, and compilation fails if the query is invalid. The validation does not alter the database state.
- Scala 3 support: ProtoQuill provides Scala 3 support, rebuilt on top of new metaprogramming capabilities, published as the
quill-_3line of artifacts. - Doobie integration: Instructions for integrating with Doobie are available.
Use cases
ZIO Quill is suitable for applications that require type-safe, compile-time checked database queries in Scala. It can be used with SQL databases (e.g., PostgreSQL, MySQL) and Cassandra. The compile-time query generation and validation help catch errors early in the development cycle, making it useful for projects where query correctness and performance are important.
Getting started
See the repository README for installation and quick-start instructions.
License and pricing
ZIO Quill is open source under the Apache-2.0 license. The pricing type is listed as open source.
Based on the project's public README and repository metadata.