Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Graphql Engine | 30,513 | 3 | 16 hours ago | 17 | June 22, 2022 | 2,178 | apache-2.0 | TypeScript | ||
Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events. | ||||||||||
Rxdb | 19,950 | 82 | 84 | 11 hours ago | 502 | December 03, 2023 | 6 | apache-2.0 | TypeScript | |
A fast, local first, reactive Database for JavaScript Applications https://rxdb.info/ | ||||||||||
Graphql Js | 19,769 | 33,257 | 15,325 | 12 days ago | 238 | October 14, 2023 | 274 | mit | TypeScript | |
A reference implementation of GraphQL for JavaScript | ||||||||||
Apollo Server | 13,544 | 5,326 | 1,415 | 4 days ago | 313 | November 14, 2023 | 64 | mit | TypeScript | |
🌍 Spec-compliant and production ready JavaScript GraphQL server that lets you develop in a schema-first way. Built for Express, Connect, Hapi, Koa, and more. | ||||||||||
Crystal | 12,263 | 76 | 122 | 19 hours ago | 233 | October 30, 2023 | 68 | other | TypeScript | |
🔮 Graphile's Crystal Monorepo; home to Grafast, PostGraphile, pg-introspection, pg-sql2 and much more! | ||||||||||
Edgedb | 11,880 | 11 hours ago | 2 | June 08, 2018 | 631 | apache-2.0 | Python | |||
A graph-relational database with declarative schema, built-in migration system, and a next-generation query language | ||||||||||
Graphql Code Generator | 10,419 | 189 | 13 hours ago | 1,363 | November 27, 2023 | 526 | mit | TypeScript | ||
A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins. | ||||||||||
Gqlgen | 9,327 | 115 | 895 | 2 days ago | 219 | December 03, 2023 | 261 | mit | Go | |
go generate based graphql server library | ||||||||||
Type Graphql | 7,876 | 277 | 430 | 9 days ago | 70 | August 17, 2023 | 117 | mit | TypeScript | |
Create GraphQL schema and resolvers with TypeScript, using classes and decorators! | ||||||||||
Graphql Editor | 5,900 | 3 | 5 days ago | 107 | November 30, 2023 | 16 | mit | TypeScript | ||
📺 Visual Editor & GraphQL IDE. |
gqlgen is a Go library for building GraphQL servers without any fuss.
map[string]interface{}
here.Still not convinced enough to use gqlgen? Compare gqlgen with other Go graphql implementations
mkdir example
cd example
go mod init example
Add github.com/99designs/gqlgen
to your project's tools.go
printf '// +build tools\npackage tools\nimport (_ "github.com/99designs/gqlgen"\n _ "github.com/99designs/gqlgen/graphql/introspection")' | gofmt > tools.go
go mod tidy
Initialise gqlgen config and generate models
go run github.com/99designs/gqlgen init
go mod tidy
Start the graphql server
go run server.go
More help to get started:
If you think you've found a bug, or something isn't behaving the way you think it should, please raise an issue on GitHub.
We welcome contributions, Read our Contribution Guidelines to learn more about contributing to gqlgen
When you have nested or recursive schema like this:
type User {
id: ID!
name: String!
friends: [User!]!
}
You need to tell gqlgen that it should only fetch friends if the user requested it. There are two ways to do this;
Write a custom model that omits the friends field:
type User struct {
ID int
Name string
}
And reference the model in gqlgen.yml
:
# gqlgen.yml
models:
User:
model: github.com/you/pkg/model.User # go import path to the User struct above
If you want to Keep using the generated model, mark the field as requiring a resolver explicitly in gqlgen.yml
like this:
# gqlgen.yml
models:
User:
fields:
friends:
resolver: true # force a resolver to be generated
After doing either of the above and running generate we will need to provide a resolver for friends:
func (r *userResolver) Friends(ctx context.Context, obj *User) ([]*User, error) {
// select * from user where friendid = obj.ID
return friends, nil
}
You can also use inline config with directives to achieve the same result
directive @goModel(model: String, models: [String!]) on OBJECT
| INPUT_OBJECT
| SCALAR
| ENUM
| INTERFACE
| UNION
directive @goField(forceResolver: Boolean, name: String, omittable: Boolean) on INPUT_FIELD_DEFINITION
| FIELD_DEFINITION
type User @goModel(model: "github.com/you/pkg/model.User") {
id: ID! @goField(name: "todoId")
friends: [User!]! @goField(forceResolver: true)
}
Yes! You can by remapping it in config as seen below:
models:
ID: # The GraphQL type ID is backed by
model:
- github.com/99designs/gqlgen/graphql.IntID # a go integer
- github.com/99designs/gqlgen/graphql.ID # or a go string
This means gqlgen will be able to automatically bind to strings or ints for models you have written yourself, but the first model in this list is used as the default type and it will always be used when:
There isn't any way around this, gqlgen has no way to know what you want in a given context.
These were added in v0.17.14 to allow accessing common interface fields without casting to a concrete type. However, certain fields, like Relay-style Connections, cannot be implemented with simple getters.
If you'd prefer to not have getters generated in your interfaces, you can add the following in your gqlgen.yml
:
# gqlgen.yml
omit_getters: true