abstract class DatabaseModuleBase[Connection, Database <: ServiceOps[Connection]] extends ModuleOps[Connection, Database]
Template implementing the commodity methods for a Db module.
- Alphabetic
- By Inheritance
- DatabaseModuleBase
- ModuleOps
- DatabaseOps
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new DatabaseModuleBase()(implicit arg0: Tag[Database])
Type Members
- type Service = ServiceOps[Connection]
Abstract Value Members
- abstract def connectionFromJdbc(connection: => Connection)(implicit trace: Trace): ZIO[Any, Nothing, Connection]
Creates a Tranzactio Connection, given a JDBC connection and a Blocking.
Creates a Tranzactio Connection, given a JDBC connection and a Blocking. Useful for some utilities.
- abstract def fromConnectionSource(implicit trace: Trace): ZLayer[ConnectionSource, Nothing, Database]
Creates a Database Layer which requires an existing ConnectionSource.
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
- def autoCommit[R, E, A](zio: => ZIO[Connection with R, E, A])(implicit errorStrategies: ErrorStrategiesRef = ErrorStrategies.Parent, trace: Trace): ZIO[Database with R, 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.
- Definition Classes
- DatabaseModuleBase → DatabaseOps
- final def autoCommitOrDie[R, E, A](zio: => ZIO[Connection with R, E, A])(implicit errorStrategies: ErrorStrategiesRef = ErrorStrategies.Parent, trace: Trace): ZIO[R with Database, E, A]
As
autoCommit, but errors when handling the connections are treated as defects instead of failures.As
autoCommit, but errors when handling the connections are treated as defects instead of failures.- Definition Classes
- DatabaseOps
- final def autoCommitOrWiden[R, E >: DbException, A](zio: => ZIO[Connection with R, E, A])(implicit errorStrategies: ErrorStrategiesRef = ErrorStrategies.Parent, trace: Trace): ZIO[R with Database, 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.- Definition Classes
- DatabaseOps
- 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 fromDatasource(errorStrategies: ErrorStrategiesRef)(implicit trace: Trace): ZLayer[DataSource, Nothing, Database]
As
fromDatasource, but provides a default ErrorStrategiesRef.As
fromDatasource, but provides a default ErrorStrategiesRef. When a method is called with no available implicit ErrorStrategiesRef, the ErrorStrategiesRef in argument will be used. - final def fromDatasource(implicit trace: Trace): ZLayer[DataSource, Nothing, Database]
Commodity method: creates a Database Layer which includes its own ConnectionSource based on a DataSource.
Commodity method: creates a Database Layer which includes its own ConnectionSource based on a DataSource. Most connection pool implementations should be able to provide you a DataSource.
When no implicit ErrorStrategies is available, the default ErrorStrategies will be used.
- final def fromDatasourceAndErrorStrategies(implicit trace: Trace): ZLayer[DataSource with ErrorStrategies, Nothing, Database]
As
fromDatasource(ErrorStrategiesRef), but anErrorStrategiesis provided through a layer instead of as a parameter. - 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
- def transaction[R, E, A](zio: => ZIO[Connection with R, E, A], commitOnFailure: => Boolean = false)(implicit errorStrategies: ErrorStrategiesRef = ErrorStrategies.Parent, trace: Trace): ZIO[Database with R, 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.
- Definition Classes
- DatabaseModuleBase → DatabaseOps
- 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 Database, E, A]
As
transaction, but errors when handling the connections are treated as defects instead of failures.As
transaction, but errors when handling the connections are treated as defects instead of failures.- Definition Classes
- DatabaseOps
- 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 Database, 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.- Definition Classes
- DatabaseOps
- 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