-
Notifications
You must be signed in to change notification settings - Fork 5
Prototype #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Extended it to support POST using `httprouter`.
My next step is to pull the DAL from https://github.com/riptano/cloud-ondemand/tree/master/data-endpoint/pkg/db and start to generate GraphQL schema from the schema metadata. |
@jorgebay Feel free to modify this however, and push right to it. |
Great way to kickstart the project 👍 |
Only supports basic types
Pushed basic read and schema generation functionality. Also integrated with your DB class and pushed a test schema with it: https://github.com/riptano/data-endpoints/blob/prototype/store.cql Currently, the resolver for the select is in a big-ish closure which is not ideal (just getting stuff working/started). That needs to be extracted out and generalized so that we can easily add revolvers for create, update, and delete. |
Nice! I've added insert mutation and I'll push delete soon. |
* Rely more on GraphQL parameter validation * Removed "metadata" and "*Meta" from C* metadata types
Here's the graphql query to create a table: mutation TableMutation
{
createTable(name:"sample", partitionKeys: [
{ name: "id1", type: { basic: INT } },
{ name: "id2", type: { basic: TEXT } }
], clusteringKeys: [
{ name: "ck1", type: { basic: INT } },
], values: [
{ name: "col2", type: { basic: TEXT } },
])
} |
Table schema query: query {
table(name: "BooksByAuthor") {
name
columns {
name
kind
type {
basic
subTypes {
basic
}
}
}
}
tables {
name
columns {
kind
type {
basic
}
}
}
} |
Abstracted away the database and using routes as the boundary layer between our API and the Astra/Community server. Names are placeholders. Feel free to change anything. // Create configuration object
cfg := datastax.NewEndpointConfig("127.0.0.1")
// Configure here
// Create the endpoint
endpoint, err := cfg.NewEndpoint()
if err != nil {
log.Fatalf("unable create new endpoint: %s", err)
}
// Generate routes and add them to router
routes, err := endpoint.RoutesGql("/graphql")
if err != nil {
log.Fatalf("unable to generate graphql routes: %s", err)
}
router := httprouter.New()
for _, route := range routes {
router.HandlerFunc(route.Method, route.Pattern, route.HandlerFunc)
} |
Put up a PR for "executeAs": #3 |
API for plugin into an existing http server looks great. |
I've added support for query {
booksByAuthorFilter(filter: { firstname: { eq: "Isaac"}, lastname: { eq: "Asimov"}, title: { gte: "A" }}) {
values { title, authorId }
}
} |
Merged in proxy execute. Removed redundant execute methods from the db package.
Working on fixing/abstracting naming conventions. |
I used your idea and moved the naming conventions to a central interface and the default implementation is stateless (following the existing rules). I started with a PR (#5), but I don't want to block your work tomorrow and/or end up with a bunch of conflicts so I pulled it in. Seriously, feel free to change anything you don't like or disagree with. I also moved the GraphQL routes and schema methods into structs. This is because the number of parameters that needed to be passed around was getting out of control. |
Naming convention interface is looking great, the different methods give us the flexibility to handle different use cases.
Good idea |
hm... it seems that graphql-go doesn't correctly handle null arguments, even though it's part of the spec: graphql/graphql-spec@3ce8b79 (more background: graphql/graphql-js#133) |
Using that RFC and the existing PR I've created a fork with a mostly working patch: mpenick/graphql@3a00f1f |
Nice! let's see if we can merge it in the graphql-go project. |
Exploring GraphQL schema generation using C*/DSE schema metadata.