Packages

object DBIOAction

Source
DBIOAction.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DBIOAction
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

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 clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. def failed(t: Throwable): DBIOAction[Nothing, NoStream, Effect]

    Create a DBIOAction that always fails.

  9. def fold[T, E <: Effect](actions: Seq[DBIOAction[T, NoStream, E]], zero: T)(f: (T, T) => T): DBIOAction[T, NoStream, E]

    Create a DBIOAction that runs some other actions in sequence and combines their results with the given function.

  10. def from[R](fa: Future[R]): DBIOAction[R, NoStream, Effect]

    Lift a scala.concurrent.Future into a DBIOAction.

    Lift a scala.concurrent.Future into a DBIOAction.

    This overload is provided for interop with Play / Akka / Pekko code that produces Future values. The Future is wrapped in cats.effect.IO.fromFuture so that it is executed on the CE3 compute pool and its cancellation semantics are respected.

    def callExternalService(): Future[String] = ???
    val action: DBIO[String] = DBIO.from(callExternalService())

    For lifting a CE3 effect use DBIO.from[F[_], R](fa: F[R]) directly.

    Warning — do not call db.run inside the lifted Future. See the DBIO.from[F[_], R] overload for a full explanation of why nested db.run calls can cause a deadlock.

  11. def from[F[_], R](fa: F[R]): DBIOAction[R, NoStream, Effect]

    Lift any F[R] effect (e.g.

    Lift any F[R] effect (e.g. cats.effect.IO[R]) into a DBIOAction.

    The effect is executed on the CE3 compute pool, outside of any JDBC blocking context. Use this to interleave effectful computations (logging, UUID generation, etc.) within a DBIO action chain without needing a separate flatMap over F.

    val action: DBIO[String] = for {
      id <- DBIO.from(IO(java.util.UUID.randomUUID().toString))
      _  <- users += User(id, "Alice")
    } yield id

    Warning — do not call db.run inside the lifted effect. db.run acquires a connection-pool permit for the full duration of the outer action. Calling db.run again from within DBIO.from attempts to acquire a second permit from the same bounded pool. If all permits are already held by outer actions, every inner db.run will block forever, deadlocking the application. Compose database work as a single DBIO chain instead:

    // Wrong — nested db.run can deadlock:
    DBIO.from(db.run(otherAction))
    
    // Correct — compose as DBIO:
    otherAction.flatMap(result => nextAction(result))
  12. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. def liftF[F[_], R](fa: F[R]): DBIOAction[R, NoStream, Effect]

    Alias for from.

    Alias for from.

    Warning — do not call db.run inside the lifted effect. See DBIO.from[F[_], R] for a full explanation of why nested db.run calls can cause a deadlock.

  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  19. def seq[E <: Effect](actions: DBIOAction[_, NoStream, E]*): DBIOAction[Unit, NoStream, E]

    A simpler version of sequence that takes a number of DBIOActions with any return type as varargs and returns a DBIOAction that performs the individual actions in sequence, returning () in the end.

  20. def sequence[R, M[+_] <: IterableOnce[_], E <: Effect](in: M[DBIOAction[R, NoStream, E]])(implicit cbf: Factory[R, M[R]]): DBIOAction[M[R], NoStream, E]

    Transform a TraversableOnce[ DBIO[R] ] into a DBIO[ TraversableOnce[R] ].

  21. def sequenceOption[R, E <: Effect](in: Option[DBIOAction[R, NoStream, E]]): DBIOAction[Option[R], NoStream, E]

    Transform a Option[ DBIO[R] ] into a DBIO[ Option[R] ].

  22. def successful[R](v: R): DBIOAction[R, NoStream, Effect]

    Lift a constant value to a DBIOAction.

  23. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  24. def toString(): String
    Definition Classes
    AnyRef → Any
  25. def traverse[A, B, M[+X] <: IterableOnce[X]](in: M[A])(f: (A) => DBIO[B])(implicit cbf: Factory[B, M[B]]): DBIO[M[B]]

    Transforms an IterableOnce[A] into a DBIO[IterableOnce[B]] using the provided function A => DBIO[B].

  26. def unit: DBIOAction[Unit, NoStream, Effect]

    A no-op DBIOAction.

    A no-op DBIOAction. A cached value of DBIOAction.successful(()) to avoid allocations.

  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  28. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  29. 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

    (Since version 9)

Inherited from AnyRef

Inherited from Any

Ungrouped