Search in sources :

Example 6 with ReducedQueryErrorContext

use of com.couchbase.client.core.error.context.ReducedQueryErrorContext in project couchbase-jvm-clients by couchbase.

the class AsyncCluster method query.

/**
 * Performs a N1QL query with custom {@link QueryOptions}.
 *
 * @param statement the N1QL query statement as a raw string.
 * @param options the custom options for this query.
 * @return the {@link QueryResult} once the response arrives successfully.
 */
public CompletableFuture<QueryResult> query(final String statement, final QueryOptions options) {
    notNull(options, "QueryOptions", () -> new ReducedQueryErrorContext(statement));
    final QueryOptions.Built opts = options.build();
    JsonSerializer serializer = opts.serializer() == null ? environment.get().jsonSerializer() : opts.serializer();
    return queryAccessor.queryAsync(queryRequest(statement, opts), opts, serializer);
}
Also used : JsonSerializer(com.couchbase.client.java.codec.JsonSerializer) ReducedQueryErrorContext(com.couchbase.client.core.error.context.ReducedQueryErrorContext) QueryOptions(com.couchbase.client.java.query.QueryOptions)

Aggregations

ReducedQueryErrorContext (com.couchbase.client.core.error.context.ReducedQueryErrorContext)6 JsonSerializer (com.couchbase.client.java.codec.JsonSerializer)4 QueryOptions (com.couchbase.client.java.query.QueryOptions)4 RequestSpan (com.couchbase.client.core.cnc.RequestSpan)2 QueryRequest (com.couchbase.client.core.msg.query.QueryRequest)2 RetryStrategy (com.couchbase.client.core.retry.RetryStrategy)2 JsonObject (com.couchbase.client.java.json.JsonObject)2 Duration (java.time.Duration)2 ConnectionString (com.couchbase.client.core.util.ConnectionString)1 ConnectionStringUtil.asConnectionString (com.couchbase.client.core.util.ConnectionStringUtil.asConnectionString)1 ConnectionStringUtil.checkConnectionString (com.couchbase.client.core.util.ConnectionStringUtil.checkConnectionString)1