Search in sources :

Example 6 with JsonSerializer

use of com.couchbase.client.java.codec.JsonSerializer in project couchbase-jvm-clients by couchbase.

the class ReactiveScope method query.

/**
 * Performs a N1QL query with custom {@link QueryOptions} in a Scope
 *
 * @param statement the N1QL query statement as a raw string.
 * @param options the custom options for this query.
 * @return the {@link ReactiveQueryResult} once the response arrives successfully.
 */
public Mono<ReactiveQueryResult> 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().jsonSerializer() : opts.serializer();
    return Mono.defer(() -> {
        return async().queryAccessor().queryReactive(async().queryRequest(bucketName(), name(), statement, opts, core(), environment()), 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)

Example 7 with JsonSerializer

use of com.couchbase.client.java.codec.JsonSerializer in project couchbase-jvm-clients by couchbase.

the class ReactiveBucket method viewQuery.

public Mono<ReactiveViewResult> viewQuery(final String designDoc, final String viewName, final ViewOptions options) {
    return Mono.defer(() -> {
        notNull(options, "ViewOptions", () -> new ReducedViewErrorContext(designDoc, viewName, name()));
        ViewOptions.Built opts = options.build();
        JsonSerializer serializer = opts.serializer() == null ? environment().jsonSerializer() : opts.serializer();
        return ViewAccessor.viewQueryReactive(asyncBucket.core(), asyncBucket.viewRequest(designDoc, viewName, opts), serializer);
    });
}
Also used : ViewOptions(com.couchbase.client.java.view.ViewOptions) ReducedViewErrorContext(com.couchbase.client.core.error.context.ReducedViewErrorContext) JsonSerializer(com.couchbase.client.java.codec.JsonSerializer)

Example 8 with JsonSerializer

use of com.couchbase.client.java.codec.JsonSerializer in project couchbase-jvm-clients by couchbase.

the class ReactiveCluster 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 ReactiveQueryResult} once the response arrives successfully.
 */
public Mono<ReactiveQueryResult> 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().jsonSerializer() : opts.serializer();
    return Mono.defer(() -> {
        return asyncCluster.queryAccessor().queryReactive(asyncCluster.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)

Example 9 with JsonSerializer

use of com.couchbase.client.java.codec.JsonSerializer in project couchbase-jvm-clients by couchbase.

the class ReactiveCluster method analyticsQuery.

/**
 * Performs an Analytics query with custom {@link AnalyticsOptions}.
 *
 * @param statement the Analytics query statement as a raw string.
 * @param options the custom options for this analytics query.
 * @return the {@link ReactiveAnalyticsResult} once the response arrives successfully.
 */
public Mono<ReactiveAnalyticsResult> analyticsQuery(final String statement, final AnalyticsOptions options) {
    notNull(options, "AnalyticsOptions", () -> new ReducedAnalyticsErrorContext(statement));
    AnalyticsOptions.Built opts = options.build();
    JsonSerializer serializer = opts.serializer() == null ? environment().jsonSerializer() : opts.serializer();
    return Mono.defer(() -> {
        return AnalyticsAccessor.analyticsQueryReactive(asyncCluster.core(), asyncCluster.analyticsRequest(statement, opts), serializer);
    });
}
Also used : ReducedAnalyticsErrorContext(com.couchbase.client.core.error.context.ReducedAnalyticsErrorContext) JsonSerializer(com.couchbase.client.java.codec.JsonSerializer) AnalyticsOptions(com.couchbase.client.java.analytics.AnalyticsOptions)

Example 10 with JsonSerializer

use of com.couchbase.client.java.codec.JsonSerializer in project couchbase-jvm-clients by couchbase.

the class AsyncCollection method lookupIn.

/**
 * Performs lookups to document fragments with custom options.
 *
 * @param id the outer document ID.
 * @param specs the spec which specifies the type of lookups to perform.
 * @param options custom options to modify the lookup options.
 * @return the {@link LookupInResult} once the lookup has been performed or failed.
 */
public CompletableFuture<LookupInResult> lookupIn(final String id, final List<LookupInSpec> specs, final LookupInOptions options) {
    notNull(options, "LookupInOptions", () -> ReducedKeyValueErrorContext.create(id, collectionIdentifier));
    LookupInOptions.Built opts = options.build();
    final JsonSerializer serializer = opts.serializer() == null ? environment.jsonSerializer() : opts.serializer();
    return LookupInAccessor.lookupInAccessor(core, lookupInRequest(id, specs, opts), serializer);
}
Also used : LookupInOptions(com.couchbase.client.java.kv.LookupInOptions) JsonSerializer(com.couchbase.client.java.codec.JsonSerializer)

Aggregations

JsonSerializer (com.couchbase.client.java.codec.JsonSerializer)18 ReducedAnalyticsErrorContext (com.couchbase.client.core.error.context.ReducedAnalyticsErrorContext)4 ReducedQueryErrorContext (com.couchbase.client.core.error.context.ReducedQueryErrorContext)4 AnalyticsOptions (com.couchbase.client.java.analytics.AnalyticsOptions)4 ClusterEnvironment (com.couchbase.client.java.env.ClusterEnvironment)4 QueryOptions (com.couchbase.client.java.query.QueryOptions)4 LookupInOptions (com.couchbase.client.java.kv.LookupInOptions)3 ReducedSearchErrorContext (com.couchbase.client.core.error.context.ReducedSearchErrorContext)2 ReducedViewErrorContext (com.couchbase.client.core.error.context.ReducedViewErrorContext)2 SubdocGetRequest (com.couchbase.client.core.msg.kv.SubdocGetRequest)2 RetryStrategy (com.couchbase.client.core.retry.RetryStrategy)2 JacksonJsonSerializer (com.couchbase.client.java.codec.JacksonJsonSerializer)2 SearchOptions (com.couchbase.client.java.search.SearchOptions)2 Duration (java.time.Duration)2 Test (org.junit.jupiter.api.Test)2 Core (com.couchbase.client.core.Core)1 CoreContext (com.couchbase.client.core.CoreContext)1 Stability (com.couchbase.client.core.annotation.Stability)1 RequestSpan (com.couchbase.client.core.cnc.RequestSpan)1 TracingIdentifiers (com.couchbase.client.core.cnc.TracingIdentifiers)1