All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.stargate.sgv2.api.common.cql.builder.QueryBuilderImpl Maven / Gradle / Ivy

There is a newer version: 2.1.0-BETA-19
Show newest version
/*
 * Copyright DataStax, Inc. and/or The Stargate Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.stargate.sgv2.api.common.cql.builder;

import com.bpodgursky.jbool_expressions.Expression;
import com.bpodgursky.jbool_expressions.Variable;
import com.github.misberner.apcommons.util.AFModifier;
import com.github.misberner.duzzt.annotations.DSLAction;
import com.github.misberner.duzzt.annotations.GenerateEmbeddedDSL;
import com.github.misberner.duzzt.annotations.SubExpr;
import io.stargate.bridge.proto.QueryOuterClass.BatchQuery;
import io.stargate.bridge.proto.QueryOuterClass.Query;
import io.stargate.bridge.proto.QueryOuterClass.QueryParameters;
import io.stargate.bridge.proto.QueryOuterClass.Value;
import io.stargate.bridge.proto.QueryOuterClass.Values;
import io.stargate.bridge.proto.StargateBridge;
import io.stargate.sgv2.api.common.cql.ColumnUtils;
import io.stargate.sgv2.api.common.cql.CqlStrings;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * Convenience builder for creating queries.
 *
 * 

The generated CQL string is wrapped into a {@link Query} that can be passed directly to {@link * StargateBridge#executeQuery(Query)}. In addition, any time a {@link Value} is passed to the * builder (via such methods as {@link #where(Column, Predicate, Object)}, {@link #value(Column, * Object)}, etc.), it is automatically replaced with a bind marker, and stored in {@link * Query#getValues()}. */ @GenerateEmbeddedDSL( modifier = AFModifier.DEFAULT, autoVarArgs = false, name = "QueryBuilder", syntax = "(|

||||