AcolyteDSL
Acolyte DSL for ReactiveMongo.
Value members
Concrete methods
Creates an empty connection handler.
Creates an empty connection handler.
import acolyte.reactivemongo.AcolyteDSL
def foo = AcolyteDSL.handle
- See also:
Creates a connection handler with given query handler, but no write handler.
Creates a connection handler with given query handler, but no write handler.
import scala.concurrent.ExecutionContext
import acolyte.reactivemongo.AcolyteDSL.{
withConnection, withDriver, handleQuery
}
import acolyte.reactivemongo.{ PreparedResponse, Request }
def aResponse: PreparedResponse = ???
def foo(implicit ec: ExecutionContext) =
withDriver { implicit d =>
withConnection(handleQuery { (_: Request) => aResponse }) { _ =>
// work with connection (e.g. call you function using Mongo)
"Value"
}
}
- See also:
Creates a connection handler with given write handler, but no query handler.
Creates a connection handler with given write handler, but no query handler.
import scala.concurrent.ExecutionContext
import reactivemongo.api.AsyncDriver
import acolyte.reactivemongo.AcolyteDSL.{
withConnection, withDriver, handleWrite
}
import acolyte.reactivemongo.{ Request, WriteOp, PreparedResponse }
def aResponse: PreparedResponse = ???
def foo(implicit ec: ExecutionContext) =
withDriver { implicit d: AsyncDriver =>
withConnection(handleWrite {
(_: WriteOp, _: Request) => aResponse }) { _ =>
// work with connection (e.g. call you function using Mongo)
"Value"
}
}
- See also:
Inherited methods
Returns unmanaged driver. You will have to close it by yourself.
Returns unmanaged driver. You will have to close it by yourself.
- Inherited from:
- WithDriver
Works with specified collection from MongoDB "acolyte" resolved using given Mongo DB.
Works with specified collection from MongoDB "acolyte" resolved using given Mongo DB.
- Value parameters:
- db
Previously resolved Mongo DB
- f
Function applied to resolved Mongo collection
import scala.concurrent.{ ExecutionContext, Future } import reactivemongo.api.AsyncDriver import acolyte.reactivemongo.{ AcolyteDSL, ConnectionHandler } def s(handler: ConnectionHandler)( implicit ec: ExecutionContext, d: AsyncDriver): Future[String] = AcolyteDSL.withDB(handler) { db => AcolyteDSL.withCollection(db, "colName") { _ => "Result" } }
- name
the name of the collection
- Inherited from:
- WithCollection
Works with specified collection from MongoDB "acolyte" resolved using given connection.
Works with specified collection from MongoDB "acolyte" resolved using given connection.
- Value parameters:
- con
Previously initialized connection
- f
Function applied to resolved Mongo collection
import scala.concurrent.{ ExecutionContext, Future } import reactivemongo.api.AsyncDriver import acolyte.reactivemongo.{ AcolyteDSL, ConnectionHandler } // handler: ConnectionHandler def s(handler: ConnectionHandler)( implicit ec: ExecutionContext, d: AsyncDriver): Future[String] = AcolyteDSL.withConnection(handler) { con => AcolyteDSL.withCollection(con, "colName") { _ => "Result" } }
- name
the name of the collection
- See also:
WithDriver.withDB[T]
- Inherited from:
- WithCollection
Works with specified collection from MongoDB "acolyte"
resolved using given driver initialized with Acolyte for ReactiveMongo
(should not be used with other driver instances).
Driver and associated resources are released
after the function f
the result Future
is completed.
Works with specified collection from MongoDB "acolyte"
resolved using given driver initialized with Acolyte for ReactiveMongo
(should not be used with other driver instances).
Driver and associated resources are released
after the function f
the result Future
is completed.
- Value parameters:
- conParam
Connection manager parameter (see ConnectionManager)
- f
Function applied to resolved Mongo collection
import scala.concurrent.{ ExecutionContext, Future } import reactivemongo.api.AsyncDriver import acolyte.reactivemongo.{ AcolyteDSL, ConnectionManager } // handler: ConnectionHandler def s[T: ConnectionManager](handler: => T)( implicit ec: ExecutionContext, d: AsyncDriver): Future[String] = AcolyteDSL.withCollection(handler, "colName") { _ => "Result" }
- name
the name of the collection
- See also:
AcolyteDSL.withDB[A,B]
- Inherited from:
- WithCollection
Works with connection with options appropriate for a driver
initialized using Acolyte for ReactiveMongo
(should not be used with other driver instances).
Connection is closed after the result Future
is completed.
Works with connection with options appropriate for a driver
initialized using Acolyte for ReactiveMongo
(should not be used with other driver instances).
Connection is closed after the result Future
is completed.
- Value parameters:
- conParam
the connection manager parameter (see ConnectionManager)
- f
the function applied to initialized driver
import scala.concurrent.{ ExecutionContext, Future } import reactivemongo.api.{ MongoConnection, AsyncDriver } import acolyte.reactivemongo.{ AcolyteDSL, ConnectionHandler } // handler: ConnectionHandler def s(handler: ConnectionHandler)( implicit ec: ExecutionContext, d: AsyncDriver): Future[String] = AcolyteDSL.withConnection(handler) { (_: MongoConnection) => "Result" }
- Inherited from:
- WithDriver
Works with a Mongo database resolved using given driver initialized using Acolyte for ReactiveMongo (should not be used with other driver instances).
Works with a Mongo database resolved using given driver initialized using Acolyte for ReactiveMongo (should not be used with other driver instances).
- Value parameters:
- con
a previously initialized connection
- f
the function applied to initialized Mongo DB
import scala.concurrent.{ ExecutionContext, Future } import reactivemongo.api.{ DB, AsyncDriver } import acolyte.reactivemongo.{ AcolyteDSL, ConnectionHandler } // handler: ConnectionHandler def s(handler: ConnectionHandler)( implicit ec: ExecutionContext, d: AsyncDriver): Future[String] = AcolyteDSL.withConnection(handler) { con => AcolyteDSL.withDB(con, "my_db") { (_: DB) => "Result" } }
- name
the name of database
- See also:
AcolyteDSL.withConnection
- Inherited from:
- WithDB
Works with Mongo database (named "acolyte") resolved using given driver initialized using Acolyte for ReactiveMongo (should not be used with other driver instances).
Works with Mongo database (named "acolyte") resolved using given driver initialized using Acolyte for ReactiveMongo (should not be used with other driver instances).
- Value parameters:
- con
a previously initialized connection
- f
the function applied to initialized Mongo DB
import scala.concurrent.ExecutionContext import reactivemongo.api.{ DB, AsyncDriver } import acolyte.reactivemongo.{ AcolyteDSL, ConnectionHandler } def s(handler: ConnectionHandler)( implicit ec: ExecutionContext, d: AsyncDriver) = AcolyteDSL.withConnection(handler) { con => AcolyteDSL.withDB(con) { (_: DB) => "Result" } }
- See also:
AcolyteDSL.withConnection
- Inherited from:
- WithDB
Works with a Mongo database resolved using given driver
initialized using Acolyte for ReactiveMongo
(should not be used with other driver instances).
Driver and associated resources are released
after the function f
the result Future
is completed.
Works with a Mongo database resolved using given driver
initialized using Acolyte for ReactiveMongo
(should not be used with other driver instances).
Driver and associated resources are released
after the function f
the result Future
is completed.
- Value parameters:
- conParam
the connection manager parameter (see ConnectionManager)
- f
the function applied to initialized Mongo DB
import scala.concurrent.{ ExecutionContext, Future } import reactivemongo.api.{ DB, AsyncDriver } import acolyte.reactivemongo.{ AcolyteDSL, ConnectionHandler } def s(handler: ConnectionHandler)( implicit ec: ExecutionContext, d: AsyncDriver): Future[String] = AcolyteDSL.withDB(handler, "my_db") { (_: DB) => "Result" }
- name
the name of database
- setName
the name of the replica set (if some)
- See also:
AcolyteDSL.withConnection
- Inherited from:
- WithDB
Works with a Mongo database (named "acolyte") resolved using given driver
initialized using Acolyte for ReactiveMongo
(should not be used with other driver instances).
Driver and associated resources are released
after the function f
the result Future
is completed.
Works with a Mongo database (named "acolyte") resolved using given driver
initialized using Acolyte for ReactiveMongo
(should not be used with other driver instances).
Driver and associated resources are released
after the function f
the result Future
is completed.
- Value parameters:
- conParam
the connection manager parameter (see ConnectionManager)
- f
the function applied to initialized Mongo DB
import scala.concurrent.{ ExecutionContext, Future } import reactivemongo.api.{ DB, AsyncDriver } import acolyte.reactivemongo.{ AcolyteDSL, ConnectionHandler } def s(handler: ConnectionHandler)( implicit ec: ExecutionContext, d: AsyncDriver): Future[String] = AcolyteDSL.withDB(handler) { (_: DB) => "Result" }
- See also:
AcolyteDSL.withConnection
- Inherited from:
- WithDB
Works with MongoDB driver configured with Acolyte handlers.
Driver and associated resources are released
after the function f
the result Future
is completed.
Works with MongoDB driver configured with Acolyte handlers.
Driver and associated resources are released
after the function f
the result Future
is completed.
- Value parameters:
- f
the function applied to initialized driver
import scala.concurrent.{ ExecutionContext, Future } import reactivemongo.api.AsyncDriver import acolyte.reactivemongo.AcolyteDSL // handler: ConnectionHandler def s(implicit ec: ExecutionContext): Future[String] = AcolyteDSL.withDriver { (_: AsyncDriver) => "Result" }
- Inherited from:
- WithDriver
Works with a MongoDB driver handling only queries,
using given query handler
.
Driver and associated resources are released
after the function f
the result Future
is completed.
Works with a MongoDB driver handling only queries,
using given query handler
.
Driver and associated resources are released
after the function f
the result Future
is completed.
- Value parameters:
- handler
Query handler
import scala.concurrent.ExecutionContext import reactivemongo.api.{ AsyncDriver, MongoConnection } import acolyte.reactivemongo.{ AcolyteDSL, PreparedResponse, Request } def aResponse: PreparedResponse = ??? def foo(implicit ec: ExecutionContext, d: AsyncDriver) = AcolyteDSL.withQueryHandler({ (_: Request) => aResponse }) { (_: MongoConnection) => "aResult" }
- See also:
- Inherited from:
- WithHandler
Works with a MongoDB driver handling only queries,
and returning given result
for all of them.
Driver and associated resources are released
after the function f
the result Future
is completed.
Works with a MongoDB driver handling only queries,
and returning given result
for all of them.
Driver and associated resources are released
after the function f
the result Future
is completed.
- Value parameters:
- result
Query result
- See also:
- Inherited from:
- WithResult
Works with a MongoDB driver handling only write operations,
using given write handler
.
Driver and associated resources are released
after the function f
the result Future
is completed.
Works with a MongoDB driver handling only write operations,
using given write handler
.
Driver and associated resources are released
after the function f
the result Future
is completed.
- Value parameters:
- handler
Writer handler
import scala.concurrent.ExecutionContext import reactivemongo.api.AsyncDriver import acolyte.reactivemongo.{ AcolyteDSL, PreparedResponse, Request, WriteOp } def aResp: PreparedResponse = ??? def foo(implicit ec: ExecutionContext, d: AsyncDriver) = AcolyteDSL.withWriteHandler({ (_: WriteOp, _: Request) => aResp }) { _ => "aResult" }
- See also:
- Inherited from:
- WithHandler
Works with a MongoDB driver handling only write operations,
and returning given result
for all of them.
Driver and associated resources are released
after the function f
the result Future
is completed.
Works with a MongoDB driver handling only write operations,
and returning given result
for all of them.
Driver and associated resources are released
after the function f
the result Future
is completed.
- See also:
- Inherited from:
- WithResult