trait ConnectionFactory extends AnyRef
Provides access to a database Connection.
Implementors must make the implementation of this trait thread-safe.
- Alphabetic
- By Inheritance
- ConnectionFactory
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
connection(): Future[Connection]
Returns a future of a Connection.
-
abstract
def
shutdown(): Future[Unit]
Shuts down this connection factory.
Shuts down this connection factory.
Returned future never fails - it completes on finished shutdown attempt. After the factory is shut down it is illegal to request new connections from it.
-
abstract
def
withConnection[A](body: (Connection) ⇒ A): Future[A]
Executes a function in a context of a connection.
Executes a function in a context of a connection.
Executes a function (which can be passed as a code block) in a context of a connection obtained via
connection
method, and releases the connection afterwards. -
abstract
def
withConnectionF[A](body: (Connection) ⇒ Future[A]): Future[A]
Executes a future-returning function in a context of a connection.
Executes a future-returning function in a context of a connection.
Executes a function (which can be passed as a code block) in a context of a connection obtained via
connection
method, and releases the connection afterwards. -
abstract
def
withTransaction[A](body: (Connection) ⇒ A)(implicit timeout: Timeout): Future[A]
Executes a function in a context of a transaction.
Executes a function in a context of a transaction.
Executes a function (which can be passed as a code block) in a context of a connection obtained via
connection
method. Before the function is executed, transaction is started. After the function finishes, transaction is committed in case of a success and rolled back in case of a failure - after that, the connection is released.Because managing transaction state requires invoking functions that require specifying a timeout, this function requires an implicit timeout instance.
-
abstract
def
withTransactionF[A](body: (Connection) ⇒ Future[A])(implicit timeout: Timeout): Future[A]
Executes a future-returning function in a context of a transaction.
Executes a future-returning function in a context of a transaction.
Executes a function (which can be passed as a code block) in a context of a connection obtained via
connection
method. Before the function is executed, transaction is started. After the function finishes, transaction is committed in case of a success and rolled back in case of a failure - after that, the connection is released.Because managing transaction state requires invoking functions that require specifying a timeout, this function requires an implicit timeout instance.
TODO