trait DatabaseOps[Connection, R0] extends AnyRef
Operations for a Database, based on a few atomic operations. Can be used both by the actual DB service, or by the DB component where a Database is required in the resulting ZIO.
- R0
Environment needed to run the operations.
- Alphabetic
- By Inheritance
- DatabaseOps
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def autoCommit[R, E, A](zio: => ZIO[Connection with R, E, A])(implicit errorStrategies: ErrorStrategiesRef = ErrorStrategies.Parent, trace: Trace): ZIO[R with R0, Either[DbException, E], A]
Provides that ZIO with a Connection.
Provides that ZIO with a Connection. All DB action in the ZIO will be auto-committed. Failures in the initial ZIO will be wrapped in a Right in the error case of the resulting ZIO, with connection errors resulting in a failure with the exception wrapped in a Left.
This method should be implemented by subclasses, to provide the connection.
- abstract def transaction[R, E, A](zio: => ZIO[Connection with R, E, A], commitOnFailure: => Boolean = false)(implicit errorStrategies: ErrorStrategiesRef = ErrorStrategies.Parent, trace: Trace): ZIO[R with R0, Either[DbException, E], A]
Provides that ZIO with a Connection.
Provides that ZIO with a Connection. A transaction will be opened before any actions in the ZIO, and closed after. It will commit only if the ZIO succeeds, and rollback otherwise. Failures in the initial ZIO will be wrapped in a Right in the error case of the resulting ZIO, with connection errors resulting in a failure with the exception wrapped in a Left.
This method should be implemented by subclasses, to provide the connection.
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- final def autoCommitOrDie[R, E, A](zio: => ZIO[Connection with R, E, A])(implicit errorStrategies: ErrorStrategiesRef = ErrorStrategies.Parent, trace: Trace): ZIO[R with R0, E, A]
As
autoCommit, but errors when handling the connections are treated as defects instead of failures. - final def autoCommitOrWiden[R, E >: DbException, A](zio: => ZIO[Connection with R, E, A])(implicit errorStrategies: ErrorStrategiesRef = ErrorStrategies.Parent, trace: Trace): ZIO[R with R0, E, A]
As
autoCommit, but exceptions are simply widened to a common failure type.As
autoCommit, but exceptions are simply widened to a common failure type. The resulting failure type is a superclass of both DbException and the error type of the inital ZIO. - def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def transactionOrDie[R, E, A](zio: => ZIO[Connection with R, E, A], commitOnFailure: => Boolean = false)(implicit errorStrategies: ErrorStrategiesRef = ErrorStrategies.Parent, trace: Trace): ZIO[R with R0, E, A]
As
transaction, but errors when handling the connections are treated as defects instead of failures. - final def transactionOrWiden[R, E >: DbException, A](zio: => ZIO[Connection with R, E, A], commitOnFailure: => Boolean = false)(implicit errorStrategies: ErrorStrategiesRef = ErrorStrategies.Parent, trace: Trace): ZIO[R with R0, E, A]
As
transaction, but exceptions are simply widened to a common failure type.As
transaction, but exceptions are simply widened to a common failure type. The resulting failure type is a superclass of both DbException and the error type of the inital ZIO. - final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated