public abstract class MutationFetcher<MutationModelT extends MutationModel,ResultT> extends CassandraFetcher<ResultT>
| Modifier and Type | Field and Description |
|---|---|
protected MappingModel |
mappingModel |
protected MutationModelT |
model |
DEFAULT_CONSISTENCY, DEFAULT_PAGE_SIZE, DEFAULT_PARAMETERS, DEFAULT_SERIAL_CONSISTENCY| Modifier | Constructor and Description |
|---|---|
protected |
MutationFetcher(MutationModelT model,
MappingModel mappingModel) |
| Modifier and Type | Method and Description |
|---|---|
protected List<BuiltCondition> |
bindIf(List<ConditionModel> conditions,
Predicate<String> hasArgument,
Function<String,Object> getArgument,
Keyspace keyspace) |
protected List<BuiltCondition> |
bindWhere(List<ConditionModel> conditions,
Predicate<String> hasArgument,
Function<String,Object> getArgument,
Function<List<ConditionModel>,Optional<String>> validator,
Keyspace keyspace)
Given the WHERE conditions that were inferred from an operation signature, find out which
arguments are actually present in an runtime invocation, and bind the corresponding conditions.
|
protected Parameters |
buildParameters() |
protected void |
copyRowToEntity(Row row,
Map<String,Object> entityData,
EntityModel entity)
Copies a CQL row to a map representing the given entity.
|
protected ResultSet |
executeUnchecked(AbstractBound<?> query,
Parameters parameters,
StargateGraphqlContext context) |
protected CompletableFuture<ResultT> |
get(graphql.schema.DataFetchingEnvironment environment,
StargateGraphqlContext context) |
protected graphql.language.SourceLocation |
getCurrentFieldLocation(graphql.schema.DataFetchingEnvironment environment) |
protected Function<List<io.stargate.graphql.schema.graphqlfirst.fetchers.deployed.MutationResult>,graphql.execution.DataFetcherResult<Object>> |
getDeleteOrUpdateResultBuilder(graphql.schema.DataFetchingEnvironment environment) |
protected abstract io.stargate.graphql.schema.graphqlfirst.fetchers.deployed.MutationPayload<ResultT> |
getPayload(graphql.schema.DataFetchingEnvironment environment,
StargateGraphqlContext context) |
protected ResultSet |
query(EntityModel entity,
List<BuiltCondition> whereConditions,
Optional<Integer> limit,
Parameters parameters,
StargateGraphqlContext context)
Queries one or more instances of an entity for the given conditions.
|
protected Object |
toCqlValue(Object graphqlValue,
Column.ColumnType cqlType,
Keyspace keyspace) |
protected List<Map<String,Object>> |
toEntities(ResultSet resultSet,
EntityModel entity) |
protected graphql.ExceptionWhileDataFetching |
toGraphqlError(MutationResult.Failure failure,
graphql.language.SourceLocation location,
graphql.schema.DataFetchingEnvironment environment) |
protected graphql.ExceptionWhileDataFetching |
toGraphqlError(Throwable error,
graphql.language.SourceLocation location,
graphql.schema.DataFetchingEnvironment environment) |
protected Object |
toGraphqlValue(Object cqlValue,
Column.ColumnType cqlType,
graphql.language.Type<?> graphqlType) |
protected Map<String,Object> |
toSingleEntity(ResultSet resultSet,
EntityModel entity) |
get, isAppliedBatchprotected final MutationModelT extends MutationModel model
protected final MappingModel mappingModel
protected MutationFetcher(MutationModelT model, MappingModel mappingModel)
protected abstract io.stargate.graphql.schema.graphqlfirst.fetchers.deployed.MutationPayload<ResultT> getPayload(graphql.schema.DataFetchingEnvironment environment, StargateGraphqlContext context) throws UnauthorizedException
UnauthorizedExceptionprotected CompletableFuture<ResultT> get(graphql.schema.DataFetchingEnvironment environment, StargateGraphqlContext context)
get in class CassandraFetcher<CompletionStage<ResultT>>protected Parameters buildParameters()
protected graphql.ExceptionWhileDataFetching toGraphqlError(MutationResult.Failure failure, graphql.language.SourceLocation location, graphql.schema.DataFetchingEnvironment environment)
protected graphql.ExceptionWhileDataFetching toGraphqlError(Throwable error, graphql.language.SourceLocation location, graphql.schema.DataFetchingEnvironment environment)
protected graphql.language.SourceLocation getCurrentFieldLocation(graphql.schema.DataFetchingEnvironment environment)
protected Function<List<io.stargate.graphql.schema.graphqlfirst.fetchers.deployed.MutationResult>,graphql.execution.DataFetcherResult<Object>> getDeleteOrUpdateResultBuilder(graphql.schema.DataFetchingEnvironment environment)
protected Object toCqlValue(Object graphqlValue, Column.ColumnType cqlType, Keyspace keyspace)
protected Object toGraphqlValue(Object cqlValue, Column.ColumnType cqlType, graphql.language.Type<?> graphqlType)
protected ResultSet query(EntityModel entity, List<BuiltCondition> whereConditions, Optional<Integer> limit, Parameters parameters, StargateGraphqlContext context) throws UnauthorizedException
UnauthorizedExceptionprotected Map<String,Object> toSingleEntity(ResultSet resultSet, EntityModel entity)
protected void copyRowToEntity(Row row, Map<String,Object> entityData, EntityModel entity)
protected ResultSet executeUnchecked(AbstractBound<?> query, Parameters parameters, StargateGraphqlContext context)
protected List<BuiltCondition> bindWhere(List<ConditionModel> conditions, Predicate<String> hasArgument, Function<String,Object> getArgument, Function<List<ConditionModel>,Optional<String>> validator, Keyspace keyspace)
Example:
// Query definition
type Query { readings(sensorId: ID!, hour: Int, minute: Int): [SensorReading] }
// Inferred conditions:
sensorId = ? AND hour = ? AND minute = ?
// GraphQL call:
{ readings(sensorId: "xyz", hour: 12) { value } }
// Actual conditions:
sensorId = 'xyz' AND hour = 12
hasArgument - how to know if an argument is present (this is abstracted because in some
cases the values are not directly arguments, but instead inner fields of an object
argument).getArgument - how to get the value of an argument (same).validator - a validation function that will be applied to the actual conditions, to check
that they form a valid where clause.protected List<BuiltCondition> bindIf(List<ConditionModel> conditions, Predicate<String> hasArgument, Function<String,Object> getArgument, Keyspace keyspace)
Copyright © 2021. All rights reserved.