public class FederatedEntityFetcher extends CassandraFetcher<ResultT>
_entities query of GraphQL federation.DEFAULT_CONSISTENCY, DEFAULT_PAGE_SIZE, DEFAULT_PARAMETERS, DEFAULT_SERIAL_CONSISTENCY| Constructor and Description |
|---|
FederatedEntityFetcher(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,
EntityModel entity,
Predicate<String> hasArgument,
Function<String,Object> getArgument,
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 ResultSet |
executeUnchecked(AbstractBound<?> query,
Optional<ByteBuffer> pagingState,
Optional<Integer> pageSize,
DataStore dataStore) |
protected List<FederatedEntity> |
get(graphql.schema.DataFetchingEnvironment environment,
DataStore dataStore,
StargateGraphqlContext context) |
protected ResultSet |
query(EntityModel entity,
List<BuiltCondition> whereConditions,
Optional<ByteBuffer> pagingState,
Optional<Integer> limit,
Optional<Integer> pageSize,
DataStore dataStore,
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) |
get, getDatastoreParameterspublic FederatedEntityFetcher(MappingModel mappingModel)
protected List<FederatedEntity> get(graphql.schema.DataFetchingEnvironment environment, DataStore dataStore, StargateGraphqlContext context) throws UnauthorizedException
get in class CassandraFetcher<List<FederatedEntity>>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<ByteBuffer> pagingState, Optional<Integer> limit, Optional<Integer> pageSize, DataStore dataStore, StargateGraphqlContext context) throws UnauthorizedException
UnauthorizedExceptionprotected Map<String,Object> toSingleEntity(ResultSet resultSet, EntityModel entity)
protected ResultSet executeUnchecked(AbstractBound<?> query, Optional<ByteBuffer> pagingState, Optional<Integer> pageSize, DataStore dataStore)
protected List<BuiltCondition> bindWhere(List<ConditionModel> conditions, EntityModel entity, Predicate<String> hasArgument, Function<String,Object> getArgument, 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).protected List<BuiltCondition> bindIf(List<ConditionModel> conditions, Predicate<String> hasArgument, Function<String,Object> getArgument, Keyspace keyspace)
Copyright © 2021. All rights reserved.