-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SqlTransaction type #692
Conversation
import zio.schema.Schema | ||
|
||
trait ExprSyntaxModule { self: Jdbc => | ||
implicit final class ReadSyntax[A](self: Read[A]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo this end up being the best end-user syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about toZIO
?
imho It seems weird from user perspective to have to call both transact
and run
.
Ideally if we could omit calling run
somehow....how ZIO JDBC does that?
But overall this is great simplification, I'll let also @jczuchnowski review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure.
The semantics are that you will run the individual statements when you use run on them, but only commit them after the transact scope is done.
I think we should pick naming that makes this very clear.
Maybe withTransaction
instead of transact
?
@@ -37,4 +44,7 @@ trait Jdbc extends zio.sql.Sql with TransactionModule with JdbcInternalModule wi | |||
|
|||
def execute(update: Update[_]): ZIO[SqlDriver, Exception, Int] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to rename this to make clearer that it does not run as part of a transaction
resolves #665