This document discusses Geode GraphQL Extension (G2QL), which allows a Geode cache to be accessed via GraphQL queries and mutations. G2QL introspects a Geode cache configuration and generates a corresponding GraphQL schema. It converts GraphQL queries and mutations to Geode region operations and OQL, eliminating the need to write resolvers. G2QL addresses issues like schema duplication, boilerplate code, and inefficient data access through features like schema generation, automatic conversion of queries to Geode operations, and batching of queries. The document provides an example of G2QL in action and discusses next steps for the project.
50. Geode GraphQL Extension
● Turns your cache into GraphQL API server
● Introspects and defines GraphQL schema
- types, queries, mutations
● Converts queries & mutations to Region
Operations and OQL
- no need to write resolvers
51. G2QL introspects your cache
type Customer {
fields: - from ValueConstraint
}
type Query {
customer(key: String): Customer,
customer(firstName: String): Customer
}
type Mutation {
createCustomer(key: String!, customer: customer!): Customer,
updateCustomer(key: String!, customer: Customer!): Customer,
deleteCustomer(key: String!): Customer
}
Regions
Customer<String, Customer>
Order<String, Order>
Indexes
create index --name=FirstNameIdx
--expression=firstName --
region=/Customer
Cache Configuration GraphQL Schema
Value Constraints == Types
52. G2QL introspects your cache
type Customer {
fields: - from ValueConstraint
}
type Query {
customer(key: String): Customer,
customer(firstName: String): Customer
}
type Mutation {
createCustomer(key: String!, customer: customer!): Customer,
updateCustomer(key: String!, customer: Customer!): Customer,
deleteCustomer(key: String!): Customer
}
Regions
Customer<String, Customer>
Order<String, Order>
Indexes
create index --name=FirstNameIdx
--expression=firstName --
region=/Customer
Cache Configuration GraphQL Schema
Queries with Key & Indexes
53. G2QL introspects your cache
type Customer {
fields: - from ValueConstraint
}
type Query {
customer(key: String): Customer,
customer(firstName: String): Customer
}
type Mutation {
createCustomer(key: String!, customer: customer!): Customer,
updateCustomer(key: String!, customer: Customer!): Customer,
deleteCustomer(key: String!): Customer
}
Regions
Customer<String, Customer>
Order<String, Order>
Indexes
create index --name=FirstNameIdx
--expression=firstName --
region=/Customer
Cache Configuration GraphQL Schema
Mutations with Region operations