DBIOAction

slick.dbio.DBIOAction
See theDBIOAction companion object
sealed trait DBIOAction[+R, +S <: NoStream, -E <: Effect] extends Dumpable

A Database I/O Action that can be executed on a database. The DBIOAction type allows a separation of execution logic and resource usage management logic from composition logic. DBIOActions can be composed with methods such as andThen, andFinally and flatMap. Individual parts of a composite DBIOAction are always executed serially on a single database, but possibly in different database sessions, unless the session is pinned either explicitly (using withPinnedSession) or implicitly (e.g. through a transaction).

The actual implementation base type for all Actions is DBIOAction. StreamingDBIO and DBIO are type aliases which discard the effect type (and the streaming result type in the latter case) to make DBIOAction types easier to write when these features are not needed. All primitive DBIOActions and all DBIOActions produced by the standard combinators in Slick have correct Effect types and are streaming (if possible).

Attributes

E

The DBIOAction's effect type, e.g. Effect.Read with Effect.Write. When composing actions, the correct combined effect type will be inferred. Effects can be used in user code, e.g. to automatically direct all read-only Actions to a slave database and write Actions to the master copy.

R

The result type when executing the DBIOAction and fully materializing the result.

S

An encoding of the result type for streaming results. If this action is capable of streaming, it is Streaming[T] for an element type T. For non-streaming DBIOActions it is NoStream.

Companion:
object
Source:
DBIOAction.scala
Graph
Supertypes
trait Dumpable
class Object
trait Matchable
class Any
Known subtypes
class AndThenAction[R, S, E]
class AsTryAction[R, E]
class CleanUpAction[R, S, E]
trait DatabaseAction[R, S, E]
trait BasicAction[R, S, E]
trait BasicStreamingAction[R, T, E]
trait SqlStreamingAction[R, T, E]
trait StreamingInvokerAction[R, T, E]
trait FixedBasicAction[R, S, E]
trait SqlAction[R, S, E]
trait FixedSqlAction[R, S, E]
trait SynchronousDatabaseAction[R, S, C, SC, E]
class SuccessAction[R]
trait Fused[R, S, C, SC, E]
class FusedAndThenAction[R, S, C, SC, E]
class FailedAction[E]
class FlatMapAction[R, S, P, E]
class FutureAction[R]
class NamedAction[R, S, E]
class SequenceAction[R, R2, E]

Members list

Concise view

Value members

Concrete methods

final def >>[R2, S2 <: NoStream, E2 <: Effect](a: DBIOAction[R2, S2, E2]): DBIOAction[R2, S2, E & E2]

A shortcut for andThen.

A shortcut for andThen.

Attributes

Source:
DBIOAction.scala
def andFinally[E2 <: Effect](a: DBIOAction[_, NoStream, E2]): DBIOAction[R, S, E & E2]

Run another action after this action, whether it succeeds or fails, and then return the result of the first action. If the first action fails, its failure is propagated, whether the second action fails or succeeds. If the first action succeeds, a failure of the second action is propagated.

Run another action after this action, whether it succeeds or fails, and then return the result of the first action. If the first action fails, its failure is propagated, whether the second action fails or succeeds. If the first action succeeds, a failure of the second action is propagated.

Attributes

Source:
DBIOAction.scala
def andThen[R2, S2 <: NoStream, E2 <: Effect](a: DBIOAction[R2, S2, E2]): DBIOAction[R2, S2, E & E2]

Run another action after this action, if it completed successfully, and return the result of the second action. If either of the two actions fails, the resulting action also fails.

Run another action after this action, if it completed successfully, and return the result of the second action. If either of the two actions fails, the resulting action also fails.

Attributes

Source:
DBIOAction.scala
def asTry: DBIOAction[Try[R], NoStream, E]

Convert a successful result v of this action into a successful result Success(v) and a failure t into a successful result Failure(t). This is the most generic combinator that can be used for error recovery. If possible, use andFinally or cleanUp instead, because those combinators, unlike asTry, support streaming.

Convert a successful result v of this action into a successful result Success(v) and a failure t into a successful result Failure(t). This is the most generic combinator that can be used for error recovery. If possible, use andFinally or cleanUp instead, because those combinators, unlike asTry, support streaming.

Attributes

Source:
DBIOAction.scala
def cleanUp[E2 <: Effect](f: Option[Throwable] => DBIOAction[_, NoStream, E2], keepFailure: Boolean)(implicit executor: ExecutionContext): DBIOAction[R, S, E & E2]

Run another action after this action, whether it succeeds or fails, in order to clean up or transform an error produced by this action. The clean-up action is computed from the failure of this action, wrapped in Some, or None if this action succeeded.

Run another action after this action, whether it succeeds or fails, in order to clean up or transform an error produced by this action. The clean-up action is computed from the failure of this action, wrapped in Some, or None if this action succeeded.

Attributes

keepFailure

If this action returns successfully, the resulting action also returns successfully unless the clean-up action fails. If this action fails and keepFailure is set to true (the default), the resulting action fails with the same error, no matter whether the clean-up action succeeds or fails. If keepFailure is set to false, an error from the clean-up action will override the error from this action.

Source:
DBIOAction.scala
def collect[R2](pf: PartialFunction[R, R2])(implicit executor: ExecutionContext): DBIOAction[R2, NoStream, E]

Transform the result of a successful execution of this action, if the given partial function is defined at that value, otherwise, the result DBIOAction will fail with a NoSuchElementException.

Transform the result of a successful execution of this action, if the given partial function is defined at that value, otherwise, the result DBIOAction will fail with a NoSuchElementException.

If this action fails, the resulting action also fails.

Attributes

Source:
DBIOAction.scala
def failed: DBIOAction[Throwable, NoStream, E]

Return an action which contains the Throwable with which this action failed as its result. If this action succeeded, the resulting action fails with a NoSuchElementException.

Return an action which contains the Throwable with which this action failed as its result. If this action succeeded, the resulting action fails with a NoSuchElementException.

Attributes

Source:
DBIOAction.scala
final def filter(p: R => Boolean)(implicit executor: ExecutionContext): DBIOAction[R, NoStream, E]

Filter the result of this action with the given predicate. If the predicate matches, the original result is returned, otherwise the resulting action fails with a NoSuchElementException.

Filter the result of this action with the given predicate. If the predicate matches, the original result is returned, otherwise the resulting action fails with a NoSuchElementException.

Attributes

Source:
DBIOAction.scala
def flatMap[R2, S2 <: NoStream, E2 <: Effect](f: R => DBIOAction[R2, S2, E2])(implicit executor: ExecutionContext): DBIOAction[R2, S2, E & E2]

Use the result produced by the successful execution of this action to compute and then run the next action in sequence. The resulting action fails if either this action, the computation, or the computed action fails.

Use the result produced by the successful execution of this action to compute and then run the next action in sequence. The resulting action fails if either this action, the computation, or the computed action fails.

Attributes

Source:
DBIOAction.scala
def flatten[R2, S2 <: NoStream, E2 <: Effect](implicit ev: R <:< DBIOAction[R2, S2, E2]): DBIOAction[R2, S2, E & E2]

Creates a new DBIOAction with one level of nesting flattened, this method is equivalent to flatMap(identity).

Creates a new DBIOAction with one level of nesting flattened, this method is equivalent to flatMap(identity).

Attributes

Source:
DBIOAction.scala
def isLogged: Boolean

Whether or not this action should be included in log output by default.

Whether or not this action should be included in log output by default.

Attributes

Source:
DBIOAction.scala
def map[R2](f: R => R2)(implicit executor: ExecutionContext): DBIOAction[R2, NoStream, E]

Transform the result of a successful execution of this action. If this action fails, the resulting action also fails.

Transform the result of a successful execution of this action. If this action fails, the resulting action also fails.

Attributes

Source:
DBIOAction.scala
def named(name: String): DBIOAction[R, S, E]

Get a wrapping action which has a name that will be included in log output.

Get a wrapping action which has a name that will be included in log output.

Attributes

Source:
DBIOAction.scala

Get the equivalent non-fused action if this action has been fused, otherwise this action is returned.

Get the equivalent non-fused action if this action has been fused, otherwise this action is returned.

Attributes

Source:
DBIOAction.scala
def withFilter(p: R => Boolean)(implicit executor: ExecutionContext): DBIOAction[R, NoStream, E]

Attributes

Source:
DBIOAction.scala

Use a pinned database session when running this action. If it is composed of multiple database actions, they will all use the same session, even when sequenced with non-database actions. For non-composite or non-database actions, this has no effect.

Use a pinned database session when running this action. If it is composed of multiple database actions, they will all use the same session, even when sequenced with non-database actions. For non-composite or non-database actions, this has no effect.

Attributes

Source:
DBIOAction.scala
def zip[R2, E2 <: Effect](a: DBIOAction[R2, NoStream, E2]): DBIOAction[(R, R2), NoStream, E & E2]

Run another action after this action, if it completed successfully, and return the result of both actions. If either of the two actions fails, the resulting action also fails.

Run another action after this action, if it completed successfully, and return the result of both actions. If either of the two actions fails, the resulting action also fails.

Attributes

Source:
DBIOAction.scala
def zipWith[R2, E2 <: Effect, R3](a: DBIOAction[R2, NoStream, E2])(f: (R, R2) => R3)(implicit executor: ExecutionContext): DBIOAction[R3, NoStream, E & E2]

Run another action after this action, if it completed successfully, and zip the result of both actions with a function f, then create a new DBIOAction holding this result, If either of the two actions fails, the resulting action also fails.

Run another action after this action, if it completed successfully, and zip the result of both actions with a function f, then create a new DBIOAction holding this result, If either of the two actions fails, the resulting action also fails.

Attributes

Source:
DBIOAction.scala

Inherited methods

Return the name, main info, attribute info and named children

Return the name, main info, attribute info and named children

Attributes

Inherited from:
Dumpable
Source:
TreePrinter.scala