object AcolyteDSL extends WithDriver with WithDB with WithCollection with WithHandler with WithResult
Acolyte DSL for ReactiveMongo.
- Alphabetic
- By Inheritance
- AcolyteDSL
- WithResult
- WithHandler
- WithCollection
- WithDB
- WithDriver
- 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
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def driver(cl: ClassLoader)(implicit m: DriverManager): AsyncDriver
Returns unmanaged driver.
Returns unmanaged driver. You will have to close it by yourself.
- Definition Classes
- WithDriver
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def handle: ConnectionHandler
Creates an empty connection handler.
Creates an empty connection handler.
import acolyte.reactivemongo.AcolyteDSL def foo = AcolyteDSL.handle
- See also
- def handleQuery[T](handler: T)(implicit f: (T) => QueryHandler): ConnectionHandler
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" } }
- def handleWrite[T](handler: T)(implicit f: (T) => WriteHandler): ConnectionHandler
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" } }
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- 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()
- def withCollection[T](db: DB, name: String)(f: (BSONCollection) => T): T
Works with specified collection from MongoDB "acolyte" resolved using given Mongo DB.
Works with specified collection from MongoDB "acolyte" resolved using given Mongo DB.
- db
Previously resolved Mongo DB
- name
the name of the collection
- 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" } }
- Definition Classes
- WithCollection
- def withCollection[T](con: => MongoConnection, name: String)(f: (BSONCollection) => T)(implicit ec: ExecutionContext, compose: ComposeWithCompletion[T]): Outer
Works with specified collection from MongoDB "acolyte" resolved using given connection.
Works with specified collection from MongoDB "acolyte" resolved using given connection.
- con
Previously initialized connection
- name
the name of the collection
- 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" } }
- Definition Classes
- WithCollection
- See also
WithDriver.withDB[T]
- def withCollection[A, B](conParam: => A, name: String)(f: (BSONCollection) => B)(implicit d: AsyncDriver, m: ConnectionManager[A], ec: ExecutionContext, compose: ComposeWithCompletion[B]): Outer
Works with specified collection from MongoDB "acolyte" resolved using given driver initialized with Acolyte for ReactiveMongo (should not be used with other driver instances).
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 resultFuture
is completed.- conParam
Connection manager parameter (see ConnectionManager)
- name
the name of the collection
- 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" }
- Definition Classes
- WithCollection
- See also
AcolyteDSL.withDB[A,B]
- def withConnection[A, B](conParam: => A)(f: (MongoConnection) => B)(implicit d: AsyncDriver, m: ConnectionManager[A], ec: ExecutionContext, compose: ComposeWithCompletion[B]): Outer
Works with connection with options appropriate for a driver initialized using Acolyte for ReactiveMongo (should not be used with other driver instances).
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.- conParam
Connection manager parameter (see ConnectionManager)
- f
the function applied to initialized Mongo DB
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" }
- Definition Classes
- WithDriver
- def withDB[T](con: => MongoConnection, name: String)(f: (DB) => T)(implicit ec: ExecutionContext, compose: ComposeWithCompletion[T]): Outer
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).
- con
a previously initialized connection
- name
the name of the collection
- 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" } }
- Definition Classes
- WithDB
- See also
AcolyteDSL.withConnection
- def withDB[T](con: => MongoConnection)(f: (DB) => T)(implicit ec: ExecutionContext, compose: ComposeWithCompletion[T]): Outer
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).
- 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" } }
- Definition Classes
- WithDB
- See also
AcolyteDSL.withConnection
- def withDB[A, B](conParam: => A, name: String, setName: Option[String] = None)(f: (DB) => B)(implicit d: AsyncDriver, m: ConnectionManager[A], ec: ExecutionContext, compose: ComposeWithCompletion[B]): Outer
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). Driver and associated resources are released after the function
f
the resultFuture
is completed.- conParam
Connection manager parameter (see ConnectionManager)
- name
the name of the collection
- setName
the name of the replica set (if some)
- 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" }
- Definition Classes
- WithDB
- See also
AcolyteDSL.withConnection
- def withDB[A, B](conParam: => A)(f: (DB) => B)(implicit d: AsyncDriver, m: ConnectionManager[A], ec: ExecutionContext, compose: ComposeWithCompletion[B]): Outer
Works with a Mongo database (named "acolyte") resolved using given driver initialized using Acolyte for ReactiveMongo (should not be used with other driver instances).
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 resultFuture
is completed.- conParam
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" }
- Definition Classes
- WithDB
- See also
AcolyteDSL.withConnection
- def withDriver[T](f: (AsyncDriver) => T)(implicit m: DriverManager, ec: ExecutionContext, compose: ComposeWithCompletion[T]): Outer
Works with MongoDB driver configured with Acolyte handlers.
Works with MongoDB driver configured with Acolyte handlers. Driver and associated resources are released after the function
f
the resultFuture
is completed.- f
the function applied to initialized Mongo DB
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" }
- Definition Classes
- WithDriver
- def withQueryHandler[T](handler: (Request) => PreparedResponse)(f: (MongoConnection) => T)(implicit d: AsyncDriver, m: ConnectionManager[ConnectionHandler], ec: ExecutionContext, compose: ComposeWithCompletion[T]): Outer
Works with a MongoDB driver handling only queries, using given query
handler
.Works with a MongoDB driver handling only queries, using given query
handler
. Driver and associated resources are released after the functionf
the resultFuture
is completed.- 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" }
- Definition Classes
- WithHandler
- See also
- def withQueryResult[A, B](result: => A)(f: (MongoConnection) => B)(implicit d: AsyncDriver, m: ConnectionManager[ConnectionHandler], mk: QueryResponseMaker[A], ec: ExecutionContext, compose: ComposeWithCompletion[B]): Outer
Works with a MongoDB driver handling only queries, and returning given
result
for all of them.Works with a MongoDB driver handling only queries, and returning given
result
for all of them. Driver and associated resources are released after the functionf
the resultFuture
is completed.- result
Query result
- Definition Classes
- WithResult
- See also
- def withWriteHandler[T](handler: (WriteOp, Request) => PreparedResponse)(f: (MongoConnection) => T)(implicit d: AsyncDriver, m: ConnectionManager[ConnectionHandler], ec: ExecutionContext, compose: ComposeWithCompletion[T]): Outer
Works with a MongoDB driver handling only write operations, using given write
handler
.Works with a MongoDB driver handling only write operations, using given write
handler
. Driver and associated resources are released after the functionf
the resultFuture
is completed.- 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" }
- Definition Classes
- WithHandler
- See also
- def withWriteResult[A, B](result: => A)(f: (MongoConnection) => B)(implicit d: AsyncDriver, m: ConnectionManager[ConnectionHandler], mk: WriteResponseMaker[A], ec: ExecutionContext, compose: ComposeWithCompletion[B]): Outer
Works with a MongoDB driver handling only write operations, and returning given
result
for all of them.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 functionf
the resultFuture
is completed.- Definition Classes
- WithResult
- See also