The name is derived from 'safe' and 'eris' (Greek for 'strife' or 'discord')
Saferis mitigates the discord of unsafe SQL. A type-safe, resource-safe SQL client library for Scala 3 and ZIO.
- SQL Injection Protection - Safe SQL interpolator with compile-time validation
- Multi-Database Support - Works with PostgreSQL, MySQL, SQLite, and any JDBC database
- Type-Safe Capabilities - Operations only available when your database supports them
- Resource Safety - Guaranteed connection and transaction management with ZIO
- Label-Based Decoding - Column-to-field mapping by name, not position
- Compile-Time Validation - Table schemas, column names, and SQL verified at compile time
- Unified Query Builder - Type-safe joins, subqueries, and pagination in one fluent API
- Streaming -
queryStreamfor real-time row iteration;pagedStream/seekingStreamfor cursor-based pagination with connection release between pages and checkpoint support for resumable processing
Add to your build.sbt:
libraryDependencies += "io.github.russwyte" %% "saferis" % "<version>"Saferis provides compile-time guarantees that operations are only available when your database supports them:
| Feature | PostgreSQL | MySQL | SQLite |
|---|---|---|---|
| RETURNING clause | Yes | No | Yes |
| JSON operations | Yes | Yes | No |
| Array types | Yes | No | No |
| UPSERT | Yes | No | No |
Switch databases by changing one import - your code adapts automatically:
import saferis.* // PostgreSQL (default)
import saferis.mysql.{given} // Override with MySQL
import saferis.sqlite.{given} // Override with SQLiteSee the full documentation for:
- Complete API reference
- Running examples with real database output
- Dialect system details
- DDL and DML operations
- Advanced pagination patterns