public class UpdateFetcher extends MutationFetcher<UpdateModel,graphql.execution.DataFetcherResult<Object>>
| Modifier and Type | Field and Description |
|---|---|
protected MappingModel |
mappingModel |
modelDEFAULT_CONSISTENCY, DEFAULT_PAGE_SIZE, DEFAULT_PARAMETERS, DEFAULT_SERIAL_CONSISTENCY| Constructor and Description |
|---|
UpdateFetcher(UpdateModel 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 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 io.stargate.graphql.schema.graphqlfirst.fetchers.deployed.MutationPayload<graphql.execution.DataFetcherResult<Object>> |
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 Object |
toGraphqlValue(Object cqlValue,
Column.ColumnType cqlType,
graphql.language.Type<?> graphqlType) |
protected Map<String,Object> |
toSingleEntity(ResultSet resultSet,
EntityModel entity) |
buildParameters, get, getCurrentFieldLocation, getDeleteOrUpdateResultBuilder, toGraphqlError, toGraphqlErrorget, isAppliedBatchprotected final MappingModel mappingModel
public UpdateFetcher(UpdateModel model, MappingModel mappingModel)
protected io.stargate.graphql.schema.graphqlfirst.fetchers.deployed.MutationPayload<graphql.execution.DataFetcherResult<Object>> getPayload(graphql.schema.DataFetchingEnvironment environment, StargateGraphqlContext context) throws UnauthorizedException
getPayload in class MutationFetcher<UpdateModel,graphql.execution.DataFetcherResult<Object>>UnauthorizedExceptionprotected 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.