public class FaunaClient
extends java.lang.Object
implements java.lang.AutoCloseable
The client is asynchronous. All methods that performs latent operations
return an instance of CompletableFuture.
The close() method must be called in order to
release the FaunaClient I/O resources.
Queries are constructed by using the static methods in the
Language class.
import static com.faunadb.client.query.Language.*;
FaunaClient client = FaunaClient.builder()
.withSecret("someAuthToken")
.build();
client.query(
Get(
Ref(Class("some_class"), "123")
)
);
Language| Modifier and Type | Class and Description |
|---|---|
static class |
FaunaClient.Builder
A builder for creating an instance of
FaunaClient |
| Modifier and Type | Method and Description |
|---|---|
static FaunaClient.Builder |
builder()
Creates a new
FaunaClient.Builder |
void |
close()
Releases any resources being held by the
FaunaClient instance. |
FaunaClient |
newSessionClient(java.lang.String secret)
Creates a session client with the user secret provided.
|
java.util.concurrent.CompletableFuture<java.util.List<Value>> |
query(Expr... exprs)
Issues multiple queries to FaunaDB.
|
java.util.concurrent.CompletableFuture<Value> |
query(Expr expr)
Issues a Query to FaunaDB.
|
java.util.concurrent.CompletableFuture<java.util.List<Value>> |
query(java.util.List<? extends Expr> exprs)
Issues multiple queries to FaunaDB.
|
public static FaunaClient.Builder builder()
FaunaClient.BuilderFaunaClient.Builderpublic FaunaClient newSessionClient(java.lang.String secret)
Connection instance
and must be closed after used.secret - user secret for the session clientFaunaClientpublic void close()
FaunaClient instance.close in interface java.lang.AutoCloseablepublic java.util.concurrent.CompletableFuture<java.util.List<Value>> query(Expr... exprs)
These queries are sent to FaunaDB in a single request. A list containing all responses is returned in the same order as the issued queries.
exprs - the list of queries to be sent to FaunaDB.CompletableFuture containing an ordered list of the query's responses.public java.util.concurrent.CompletableFuture<java.util.List<Value>> query(java.util.List<? extends Expr> exprs)
These queries are sent to FaunaDB in a single request. A list containing all responses is returned in the same order as the issued queries.
exprs - the list of queries to be sent to FaunaDB.CompletableFuture containing an ordered list of the query's responses.