Add scalasql-zio module: ZIO interop layer#121
Open
ivan-klass wants to merge 1 commit into
Open
Conversation
Wraps ScalaSql's JDBC `DbApi`/`DbClient` in ZIO effects, providing type-safe database operations and transactions with savepoints. JDBC errors are wrapped in `DbException` and committed/rolled back automatically by the enclosing `transaction` scope. - New Mill module `scalasql-zio` (Scala 3, depends on `scalasql` + `dev.zio::zio`) - Packages `scalasql` (PrimaryKey, DbEntityName, DbLookupException, IsCovariantHK) and `scalasql.dbzio` (ZDbApi, ZDbTxnApi, ZDbClient, DbOp, Savepoint, syntax) - Tests on in-memory SQLite via zio-test (no external services) Ported from https://github.com/typebricks/scalasql-zio Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
NPCRUS
reviewed
Jun 28, 2026
| effects, providing type-safe database operations and transactions with savepoints. Scala 3 only. | ||
|
|
||
| ```scala | ||
| ivy"com.lihaoyi::scalasql-zio:0.3.0" |
Collaborator
There was a problem hiding this comment.
0.3.1 or 0.3.2 i guess, depends on how we will publish this
NPCRUS
reviewed
Jun 28, 2026
| @@ -0,0 +1,23 @@ | |||
| package scalasql | |||
|
|
|||
| object IsCovariantHK: | |||
Collaborator
There was a problem hiding this comment.
- doesn't look like this should live inside dbzio
- don't know if we need it at all
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a new
scalasql-ziomodule that wraps ScalaSql's JDBCDbApi/DbClientin ZIO effects — type-safe database operations and transactions with savepoints. Scala 3 only.This ports https://github.com/typebricks/scalasql-zio (authored by me) into the main repo, converting the sbt build to Mill and moving the code under the
scalasqlnamespace.API
scalasqlpackage —PrimaryKey(zero-cost typed PKs),DbEntityName,DbLookupException(NotFound/MultipleResults),IsCovariantHK/widenK.scalasql.dbziopackage —ZDbApi/ZDbTxnApi/ZDbClient(ZIO wrappers aroundDbApi/DbClient),DbOp/DbZIOhelpers,Savepoint, andatMostOne/orNotFoundsyntax.The subpackage is named
dbzio(notzio) on purpose:scalasql.ziowould shadow_root_.ziounder wildcard imports.JDBC errors are wrapped in
DbException; the enclosingtransactioncommits on success and rolls back on failure.Build / test
scalasql-zio(depends onscalasql+dev.zio::zio), mirroring the layout ofscalasql-simple.zio-test— no external services needed. They are picked up by the existing__.testCI step.ironwas dropped; refinedEmail/UserNametypes in tests are now plain opaque types.__.fix(scalafixRemoveUnused).Notes / open questions
com.lihaoyiorg → artifactscalasql-zio_3. Happy to add a developer entry / adjust attribution as maintainers prefer.readme.mdgains a short "ZIO integration" section.🤖 Generated with Claude Code