191 karma · joined Jun 1, 2017 (9y ago) · 123 submissions
https://github.com/dosco/super-graph
comment 3y ago · link · parent
comment 3y ago · link · parent
Shameless plug but this was my motivation behind building GraphJin a GraphQL to SQL compiler and it's my single goto force multipler for most projects. https://github.com/dosco/graphjin
3.
Show HN: Create REST APIs with just a simple GraphQL query.(github.com ↗)
5 points · by gsvclass · 4y ago · discuss
5.
ReFi Movement: Helping People and the Planet(cryptogood.substack.com ↗)
1 points · by gsvclass · 4y ago · discuss
comment 4y ago · link · parent
comment 4y ago · link · parent
Here's an example of a relatively complex query that you'd need when building something like a blog. GraphJin will compile this nested query into a single efficient SQL statement.
https://gist.github.com/dosco/f604c47c1d643fb62072f62c4f6f70...
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent
Here's an example https://pkg.go.dev/github.com/dosco/graphjin/core#example-pa...
And here's an example of a Redis custom resolver to join with data from Redis. https://pkg.go.dev/github.com/dosco/graphjin/core#Resolver
comment 4y ago · link · parent
Here's a quick example of using it as a library in your own code.
https://gist.github.com/dosco/2422006fe322bd81c00988570f50a5...
comment 4y ago · link · parent
Also in production the query is compiled into a db prepared statement the first time and then on queries after validation go directly to the prepared statement. This is no different than a hand written HTTP endpoint + ORM.
Addition if using the standalone service is not for you then you can use GraphJin as sort of an ORM within your own http handlers.
The question around why use it is complex. Some reasons even nested queries and mutations are compiled to a single SQL query. Knowledge of indexes is used to write a fast query. Support for things like joining again Postgres Array columns, JSON columns, fast cursor pagination, Graph queries using recursive CTEs, full-text search and a lot more out of the box and will work on Postgres, Mysql, Cockroach, Yugabyte and I'm working on more.
comment 4y ago · link · parent
comment 4y ago · link · parent
comment 4y ago · link · parent