diff --git a/slick/src/main/scala/slick/dbio/DBIOAction.scala b/slick/src/main/scala/slick/dbio/DBIOAction.scala index cc8f188add..82a39ec0ab 100644 --- a/slick/src/main/scala/slick/dbio/DBIOAction.scala +++ b/slick/src/main/scala/slick/dbio/DBIOAction.scala @@ -120,9 +120,7 @@ sealed trait DBIOAction[+R, +S <: NoStream, -E <: Effect] extends Dumpable { def isLogged: Boolean = false } -private object DBIO extends DBIOModule // for backwards binary compatbility - -class DBIOModule { +object DBIOAction { /** Convert a `Future` to a [[DBIOAction]]. */ def from[R](f: Future[R]): DBIOAction[R, NoStream, Effect] = FutureAction[R](f) diff --git a/slick/src/main/scala/slick/dbio/package.scala b/slick/src/main/scala/slick/dbio/package.scala index 8d69fa7adb..de3b5c02ab 100644 --- a/slick/src/main/scala/slick/dbio/package.scala +++ b/slick/src/main/scala/slick/dbio/package.scala @@ -8,5 +8,5 @@ package object dbio { /** Simplified type for a [[DBIOAction]] without streaming or effect tracking */ type DBIO[+R] = DBIOAction[R, NoStream, Effect.All] - val DBIO = new DBIOModule + val DBIO = DBIOAction } diff --git a/slick/src/sphinx/dbio.rst b/slick/src/sphinx/dbio.rst index 84906aad0e..c3ad2b3af2 100644 --- a/slick/src/sphinx/dbio.rst +++ b/slick/src/sphinx/dbio.rst @@ -8,7 +8,7 @@ Anything that you can execute on a database, whether it is a getting the result execute it. *Database I/O Actions* can be combined with several different combinators (see the -:api:`DBIOAction class ` and :api:`DBIO object ` +:api:`DBIOAction class ` and :api:`DBIO object ` for details), but they will always be executed strictly sequentially and (at least conceptually) in a single database session. @@ -86,13 +86,13 @@ sequence of execution and result in a failed ``Future`` or *Reactive Stream*. Sequential Execution ____________________ -The simplest combinator is :api:`DBIO.seq ` +The simplest combinator is :api:`DBIO.seq ` which takes a varargs list of actions to run in sequence, discarding their return value. If you need the return value, you can use :api:`andThen ` to combine two actions and keep the result of the second one. If you need both return values of two actions, there is the :api:`zip ` combinator. For getting all result values from a sequence of actions (of compatible types), use -:api:`DBIO.sequence `. +:api:`DBIO.sequence `. All these combinators work with pre-existing ``DBIOAction``\ s which are composed eagerly. If an action depends on a previous action in the sequence, you have to compute it on the fly with @@ -107,8 +107,8 @@ way Slick ensures that no non-database code is run on the database thread pool. You should prefer the less flexible methods without an ``ExecutionContext`` where possible. The resulting actions can be executed more efficiently. -Similar to :api:`DBIO.sequence ` -for upfront composition, there is :api:`DBIO.fold ` +Similar to :api:`DBIO.sequence ` +for upfront composition, there is :api:`DBIO.fold ` for working with sequences of actions and composing them based on the previous result. Error Handling @@ -132,10 +132,10 @@ one and the cleanup failed. Primitives __________ -You can convert a ``Future`` into an action with :api:`DBIO.from `. +You can convert a ``Future`` into an action with :api:`DBIO.from `. This allows the result of the ``Future`` to be used in an action sequence. A pre-existing value or -failure can be converted with :api:`DBIO.successful ` -and :api:`DBIO.failed `, respectively. +failure can be converted with :api:`DBIO.successful ` +and :api:`DBIO.failed `, respectively. Debugging _________ diff --git a/slick/src/sphinx/sql.rst b/slick/src/sphinx/sql.rst index b31464ca67..de6e31f02c 100644 --- a/slick/src/sphinx/sql.rst +++ b/slick/src/sphinx/sql.rst @@ -53,16 +53,16 @@ The SQL statement produced by this method is always the same:: insert into coffees values (?, ?, ?, ?, ?) Note the use of the -:api:`DBIO.sequence ` +:api:`DBIO.sequence ` combinator which is useful for this kind of code: .. includecode:: code/PlainSQL.scala#sequence Unlike the simpler -:api:`DBIO.seq ` +:api:`DBIO.seq ` combinator which runs a (varargs) sequence of database I/O actions in the given order and discards the return values, -:api:`DBIO.sequence ` +:api:`DBIO.sequence ` turns a ``Seq[DBIO[T]]`` into a ``DBIO[Seq[T]]``, thus preserving the results of all individual actions. It is used here to sum up the affected row counts of all inserts.