Before, struggle with SQL
type User struct { gorm.Model Profile Profile ProfileID int } type Profile struct { gorm.Model Name string } db.Model(&user). Related(&profile). Association("Languages"). Where("name in (?)", []string{"test"}). Joins("left join emails on emails.user_id = users.id") Find(&users) and more ...
With Super Graph, just ask.
query { user(id: 5) { id first_name last_name picture_url posts(first: 20, order_by: { score: desc }) { slug title created_at votes_total votes { created_at } author { id name } tags { id name } } posts_cursor } }
{{ feature.title }}
{{ feature.details }}
Super Graph is a library and service that fetches data from any Postgres database using just GraphQL. No more struggling with ORMs and SQL to wrangle data out of the database. No more having to figure out the right joins or making ineffiient queries. However complex the GraphQL, Super Graph will always generate just one single efficient SQL query. The goal is to save you time and money so you can focus on you're apps core value.
Try Super Graph
Deploy as a service using docker
$ git clone https://github.com/dosco/super-graph && cd super-graph && make install
$ super-graph new blog; cd blog
$ docker-compose run blog_api ./super-graph db:setup
$ docker-compose up
Or use it with your own code
package main import ( "database/sql" "fmt" "time" "github.com/dosco/super-graph/config" "github.com/dosco/super-graph/core" _ "github.com/jackc/pgx/v4/stdlib" ) func main() { db, err := sql.Open("pgx", "postgres://postgrs:@localhost:5432/example_db") if err != nil { log.Fatalf(err) } conf, err := config.NewConfig("./config") if err != nil { log.Fatalf(err) } sg, err = core.NewSuperGraph(conf, db) if err != nil { log.Fatalf(err) } graphqlQuery := ` query { posts { id title } }` res, err := sg.GraphQL(context.Background(), graphqlQuery, nil) if err != nil { log.Fatalf(err) } fmt.Println(string(res.Data)) }
The story of {{ data.heroText }}
After working on several products through my career I find that we spend way too much time on building API backends. Most APIs also require constant updating, this costs real time and money.
It's always the same thing, figure out what the UI needs then build an endpoint for it. Most API code involves struggling with an ORM to query a database and mangle the data into a shape that the UI expects to see.
I didn't want to write this code anymore, I wanted the computer to do it. Enter GraphQL, to me it sounded great, but it still required me to write all the same database query code.
Having worked with compilers before I saw this as a compiler problem. Why not build a compiler that converts GraphQL to highly efficient SQL.
This compiler is what sits at the heart of Super Graph with layers of useful functionality around it like authentication, remote joins, rails integration, database migrations and everything else needed for you to build production ready apps with it.
It's always the same thing, figure out what the UI needs then build an endpoint for it. Most API code involves struggling with an ORM to query a database and mangle the data into a shape that the UI expects to see.
I didn't want to write this code anymore, I wanted the computer to do it. Enter GraphQL, to me it sounded great, but it still required me to write all the same database query code.
Having worked with compilers before I saw this as a compiler problem. Why not build a compiler that converts GraphQL to highly efficient SQL.
This compiler is what sits at the heart of Super Graph with layers of useful functionality around it like authentication, remote joins, rails integration, database migrations and everything else needed for you to build production ready apps with it.
GraphQL the future of APIs
Keeping a tight and fast development loop helps you iterate quickly. Leveraging technology like Super Graph focuses your team on building the core product and not reinventing wheels. GraphQL eliminate the dependency on the backend engineering and keeps the things moving fast
No more joins joins, json, orms, just use GraphQL. Fetch all the data want in the structure you need.
query { thread { slug title published createdAt : created_at totalVotes : cached_votes_total totalPosts : cached_posts_total vote : thread_vote(where: { user_id: { eq: $user_id } }) { created_at } topics { slug name } author : me { slug } posts(first: 1, order_by: { score: desc }) { slug body published createdAt : created_at totalVotes : cached_votes_total totalComments : cached_comments_total vote { created_at } author : user { slug firstName : first_name lastName : last_name } } posts_cursor } }
Instant results using a single highly optimized SQL. It's just that simple.
{ "data": { "thread": { "slug": "eveniet-ex-24", "vote": null, "posts": [ { "body": "Dolor laborum harum sed sit est ducimus temporibus velit non nobis repudiandae nobis suscipit commodi voluptatem debitis sed voluptas sequi officia.", "slug": "illum-in-voluptas-1418", "vote": null, "author": { "slug": "sigurd-kemmer", "lastName": "Effertz", "firstName": "Brandt" }, "createdAt": "2020-04-07T04:22:42.115874+00:00", "published": true, "totalVotes": 0, "totalComments": 2 } ], "title": "In aut qui deleniti quia dolore quasi porro tenetur voluptatem ut adita alias fugit explicabo.", "author": null, "topics": [ { "name": "CloudRun", "slug": "cloud-run" }, { "name": "Postgres", "slug": "postgres" } ], "createdAt": "2020-04-07T04:22:38.099482+00:00", "published": true, "totalPosts": 24, "totalVotes": 0, "posts_cursor": "mpeBl6L+QfJHc3cmLkLDj9pOdEZYTt5KQtLsazG3TLITB3hJhg==" } } }
Build Secure Apps
More Features
{{ data.footer }}