Hi,
Generally for a query in zio quill, which returns some result of type A, if I run this query it would usually return an IO[SQLException, A].
However if I wrap runing of multiple queries in a transaction, then the resulting ZIO always has error type Throwable.
This seems to go against the in code documentation, stating that:
{{{
val a = run(query[Person].insert(Person(...)): ZIO[DataSource, SQLException, Long]
val b = run(query[Person]): ZIO[DataSource, SQLException, Person]
transaction(a *> b): ZIO[DataSource, SQLException, Person]
}}}
So preferably the transaction method would have a signature like:
def transaction[R, E <: Throwable, A](op: ZIO[R, E, A]): ZIO[R, E, A]
However, I see that the dsDelegate.transaction method also depends on a connection, which has error type SQLException.
So since union types are not neatly implemented in scala 2 I understand why a more specific error type then Throwable would be a problem.
I was wondering, doesn't a transaction always expect runned database queries? So the method type be refined to the following?
def transaction[R, E <: SQLException, A](op: ZIO[R, E, A]): ZIO[R, SQLException, A]
Hi,
Generally for a query in zio quill, which returns some result of type
A, if I run this query it would usually return anIO[SQLException, A].However if I wrap runing of multiple queries in a transaction, then the resulting
ZIOalways has error typeThrowable.This seems to go against the in code documentation, stating that:
So preferably the transaction method would have a signature like:
However, I see that the
dsDelegate.transactionmethod also depends on aconnection, which has error typeSQLException.So since union types are not neatly implemented in scala 2 I understand why a more specific error type then
Throwablewould be a problem.I was wondering, doesn't a transaction always expect runned database queries? So the method type be refined to the following?