Packages

c

io.github.gaelrenoux.tranzactio

DatabaseModuleBase

abstract class DatabaseModuleBase[Connection, Database <: ServiceOps[Connection]] extends ModuleOps[Connection, Database]

Template implementing the commodity methods for a Db module.

Linear Supertypes
ModuleOps[Connection, Database], DatabaseOps[Connection, Database], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DatabaseModuleBase
  2. ModuleOps
  3. DatabaseOps
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new DatabaseModuleBase()(implicit arg0: Tag[Database])

Type Members

  1. type Service = ServiceOps[Connection]

Abstract Value Members

  1. 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.

  2. abstract def fromConnectionSource(implicit trace: Trace): ZLayer[ConnectionSource, Nothing, Database]

    Creates a Database Layer which requires an existing ConnectionSource.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. 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
    DatabaseModuleBaseDatabaseOps
  6. 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
  7. 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
  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. 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.

  12. 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.

  13. final def fromDatasourceAndErrorStrategies(implicit trace: Trace): ZLayer[DataSource with ErrorStrategies, Nothing, Database]

    As fromDatasource(ErrorStrategiesRef), but an ErrorStrategies is provided through a layer instead of as a parameter.

  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  19. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. def toString(): String
    Definition Classes
    AnyRef → Any
  22. 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
    DatabaseModuleBaseDatabaseOps
  23. 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
  24. 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
  25. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  26. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from ModuleOps[Connection, Database]

Inherited from DatabaseOps[Connection, Database]

Inherited from AnyRef

Inherited from Any

Ungrouped