object DBIOAction
- Source
- DBIOAction.scala
- Alphabetic
- By Inheritance
- DBIOAction
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
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
- implicit def catsMonadErrorForDBIOEffect[E <: Effect]: MonadError[[A]DBIOAction[A, NoStream, E], Throwable]
catsinstance for values typed with theDBIOEffect[E, *]alias, for any effectE.catsinstance for values typed with theDBIOEffect[E, *]alias, for any effectE. This coversDBIO(which isDBIOEffect[Effect.All, *]) and the results of the standard combinators. It lives here because the implicit scope of an alias is that of its expansion,DBIOAction[R, NoStream, E]. See DBIOBase. - implicit def catsMonoidForDBIOEffect[E <: Effect, A](implicit A: Monoid[A]): Monoid[DBIOEffect[E, A]]
catsMonoid forDBIOEffect[E, A](includingDBIO[A]) whenAhas aMonoid:x |+| yrunsx, theny, and combines the results;emptyis a successful action returningMonoid[A].empty. - implicit def catsSemigroupForDBIOEffect[E <: Effect, A](implicit arg0: Semigroup[A]): Semigroup[DBIOEffect[E, A]]
catsSemigroup forDBIOEffect[E, A](includingDBIO[A]) whenAhas aSemigroup.catsSemigroup forDBIOEffect[E, A](includingDBIO[A]) whenAhas aSemigroup. WhenAhas aMonoid, theMonoidinstance below is more specific and is chosen. - def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- def defer[R, S <: NoStream, E <: Effect](a: => DBIOAction[R, S, E]): DBIOAction[R, S, E]
Suspend the construction of an action until it is run.
Suspend the construction of an action until it is run. The by-name argument is not evaluated when
deferis called but each time the resulting action is run, and the action it produces is then run in its place, with the same result, streaming and effect types. An exception thrown while evaluating the argument fails the resulting action instead of propagating to the caller.// A new timestamp is computed for each run instead of once when the action is built val logRun: DBIO[Int] = DBIO.defer(runLog += java.time.Instant.now())
This is equivalent to
DBIO.unit.flatMap(_ => a)and corresponds tocats.Defer.deferandcats.effect.IO.defer. To lift a lazily computed value rather than an action, useDBIO.defer(DBIO.successful(v)). - final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def failed(t: Throwable): DBIOEffect[Effect, Nothing]
Create a DBIOAction that always fails.
- def fold[T, E <: Effect](actions: Seq[DBIOAction[T, NoStream, E]], zero: T)(f: (T, T) => T): DBIOEffect[E, T]
Create a DBIOAction that runs some other actions in sequence and combines their results with the given function.
- def from[R](fa: Future[R]): DBIOEffect[Effect, R]
Lift a
scala.concurrent.Futureinto a DBIOAction.Lift a
scala.concurrent.Futureinto a DBIOAction.This overload is provided for interop with Play / Akka / Pekko code that produces
Futurevalues. TheFutureis wrapped incats.effect.IO.fromFutureso 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.runinside the lifted Future. See theDBIO.from[F[_], R]overload for a full explanation of why nesteddb.runcalls can cause a deadlock. - def from[F[_], R](fa: F[R]): DBIOEffect[Effect, R]
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
flatMapoverF.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.runinside the lifted effect.db.runacquires a connection-pool permit for the full duration of the outer action. Callingdb.runagain from withinDBIO.fromattempts to acquire a second permit from the same bounded pool. If all permits are already held by outer actions, every innerdb.runwill 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))
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def liftF[F[_], R](fa: F[R]): DBIOEffect[Effect, R]
Alias for
from.Alias for
from.Warning — do not call
db.runinside the lifted effect. SeeDBIO.from[F[_], R]for a full explanation of why nesteddb.runcalls can cause a deadlock. - final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- def seq[E <: Effect](actions: DBIOAction[_, NoStream, E]*): DBIOEffect[E, Unit]
A simpler version of
sequencethat 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. - def sequence[R, M[+_] <: IterableOnce[_], E <: Effect](in: M[DBIOAction[R, NoStream, E]])(implicit cbf: Factory[R, M[R]]): DBIOEffect[E, M[R]]
Transform a
TraversableOnce[ DBIO[R] ]into aDBIO[ TraversableOnce[R] ]. - def sequenceOption[R, E <: Effect](in: Option[DBIOAction[R, NoStream, E]]): DBIOEffect[E, Option[R]]
Transform a
Option[ DBIO[R] ]into aDBIO[ Option[R] ]. - def successful[R](v: R): DBIOEffect[Effect, R]
Lift a constant value to a DBIOAction.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- 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 aDBIO[IterableOnce[B]]using the provided functionA => DBIO[B]. - def unit: DBIOEffect[Effect, Unit]
A no-op DBIOAction.
A no-op DBIOAction. A cached value of
DBIOAction.successful(())to avoid allocations. - 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
(Since version 9)

edit this text on github
Scala Language-Integrated Connection Kit
This is the API documentation for the Slick database library. It should be used as an additional resource to the user manual.
Further documentation for Slick can be found on the documentation pages.
To the slick package list...