Skip to content

Commit

Permalink
Prior art
Browse files Browse the repository at this point in the history
  • Loading branch information
vektah committed Feb 11, 2018
1 parent 45b79a1 commit e032c1d
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This is a library for quickly creating a strictly typed graphql servers in golang.

`go get -u github.com/vektah/gqlgen`

#### Try it

Define your schema first:
Expand Down Expand Up @@ -85,3 +85,41 @@ func main() {
log.Fatal(http.ListenAndServe(":8080", nil))
}
```

#### Prior art

##### https://github.com/neelance/graphql-go

The gold standard of graphql servers in golang. It provided the inspiration, and a good chunk of code for gqlgen. Its
strictly typed and uses your schema and some reflection to build up a resolver graph. The only downside is the amount
of work building up all of the resolvers, wrapping every object manually.

Reasons to use gqlgen instead:
- We bind directly to your types, you dont need to bind manually https://github.com/neelance/graphql-go/issues/28
- We show you the interface required, no guess work https://github.com/neelance/graphql-go/issues/159
- We use separate resolvers for query and mutation https://github.com/neelance/graphql-go/issues/145
- Code generation makes nil pointer juggling explicit, fixing issues like https://github.com/neelance/graphql-go/issues/125
- Code generating makes binding issues obvious https://github.com/neelance/graphql-go/issues/33
- Separating the resolvers from the data graph means we only need gofuncs around database calls, reducing the cost of https://github.com/neelance/graphql-go/pull/102
- arrays work just fine https://github.com/neelance/graphql-go/issues/144
- first class dataloader support, see examples/dataloader

##### https://github.com/graphql-go/graphql

With this library you write the schema using its internal DSL as go code, and bind in all your resolvers. No go type
information is used so you can dynamically define new schemas which could be useful for building schema stitching
servers at runtime.

Reasons to use gqlgen instead:
- strict types. Why go to all the effort of defining gql schemas and then bind it to interface{} everywhere?
- first class dataloader support, see examples/dataloader
- horrible runtime error messages when you mess up defining your schema https://github.com/graphql-go/graphql/issues/234
- reviewing schema changes written in a go dsl is really hard across teams

##### https://github.com/Applifier/graphql-codegen and https://github.com/euforic/graphql-gen-go

Very similar idea, take your schema and generate the code from it.

gqlgen will build the entire execution environment statically, allowing go's type checker to validate everything across
the the graph. These two libraries generate resolvers that are loaded using reflection by the neelance library, so they
have most of the downsides of that with an added layer of complexity.

0 comments on commit e032c1d

Please sign in to comment.