use of com.couchbase.client.java.analytics.AnalyticsOptions in project couchbase-jvm-clients by couchbase.
the class AsyncCluster 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 AnalyticsResult} once the response arrives successfully.
*/
public CompletableFuture<AnalyticsResult> analyticsQuery(final String statement, final AnalyticsOptions options) {
notNull(options, "AnalyticsOptions", () -> new ReducedAnalyticsErrorContext(statement));
AnalyticsOptions.Built opts = options.build();
JsonSerializer serializer = opts.serializer() == null ? environment.get().jsonSerializer() : opts.serializer();
return AnalyticsAccessor.analyticsQueryAsync(core, analyticsRequest(statement, opts), serializer);
}
use of com.couchbase.client.java.analytics.AnalyticsOptions in project couchbase-jvm-clients by couchbase.
the class AsyncAnalyticsIndexManager method exec.
/**
* Executes a statement with options against analytics.
*
* @param statement the statement of the query.
* @param options the options that should be passed along.
* @param spanName the name of the span as the outer parent.
* @return a future eventually containing the analytics result once complete, or a failure.
*/
private CompletableFuture<AnalyticsResult> exec(final String statement, final CommonOptions<?>.BuiltCommonOptions options, final String spanName) {
RequestSpan parent = CbTracing.newSpan(cluster.environment().requestTracer(), spanName, options.parentSpan().orElse(null));
final AnalyticsOptions analyticsOptions = toAnalyticsOptions(options).parentSpan(parent);
return cluster.analyticsQuery(statement, analyticsOptions).whenComplete((r, t) -> parent.end());
}
Aggregations