Class/Object

faunadb

FaunaClient

Related Docs: object FaunaClient | package faunadb

Permalink

class FaunaClient extends AnyRef

The Scala native client for FaunaDB.

Create a new client using FaunaClient.apply.

Query requests are made asynchronously: All methods will return a scala.concurrent.Future.

Example:

case class User(ref: RefV, name: String, age: Int)

val client = FaunaClient(secret = "myKeySecret")

val fut = client.query(Get(Ref("classes/users/123")))
val instance = Await.result(fut, 5.seconds)

val userCast =
  for {
    ref <- instance("ref").to[RefV]
    name <- instance("data", "name").to[String]
    age <- instance("data", "age").to[Int]
  } yield {
    User(ref, name, age)
  }

userCast.get
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. FaunaClient
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new FaunaClient(connection: Connection)

    Permalink

    create a new client with a configured com.faunadb.common.Connection.

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def close(): Unit

    Permalink

    Frees any resources held by the client and close the underlying connection.

  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  11. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  12. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  14. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  15. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  16. def query(exprs: Iterable[Expr])(implicit ec: ExecutionContext): Future[IndexedSeq[Value]]

    Permalink

    Issues multiple queries as a single transaction.

    Issues multiple queries as a single transaction.

    exprs

    the queries to run.

    returns

    A scala.concurrent.Future containing an IndexedSeq of the results of each query. Each result is an instance of faunadb.values.Value, which can be cast to a typed value using the faunadb.values.Field API. If *any* query fails, a failed future is returned.

  17. def query(expr: Expr)(implicit ec: ExecutionContext): Future[Value]

    Permalink

    Issues a query.

    Issues a query.

    expr

    the query to run, created using the query dsl helpers in faunadb.query.

    returns

    A scala.concurrent.Future containing the query result. The result is an instance of faunadb.values.Result, which can be cast to a typed value using the faunadb.values.Field API. If the query fails, failed future is returned.

  18. def sessionWith[A](secret: String)(session: (FaunaClient) ⇒ A): A

    Permalink

    Creates a new scope to execute session queries.

    Creates a new scope to execute session queries. Queries submited within the session scope will be authenticated with the secret provided. A session client shares its parent's com.faunadb.common.Connection instance and is closed as soon as the session scope ends.

    secret

    user secret for the session scope

    session

    a function that receives a session client

    returns

    the value produced by the session function

  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  20. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  21. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped