[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-5026":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":18,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":32,"readmeContent":33,"aiSummary":34,"trendingCount":16,"starSnapshotCount":16,"syncStatus":35,"lastSyncTime":36,"discoverSource":37},5026,"gqlgen","99designs\u002Fgqlgen","99designs","go generate based graphql server library","https:\u002F\u002Fgqlgen.com",null,"Go",10725,1252,122,356,0,1,3,11,44.29,"MIT License",false,"master",[25,26,27,28,29,30,31],"codegen","dataloader","gogenerate","golang","graphql","schema-first","subscriptions","2026-06-12 02:01:07","![gqlgen](https:\u002F\u002Fuser-images.githubusercontent.com\u002F980499\u002F133180111-d064b38c-6eb9-444b-a60f-7005a6e68222.png)\n\n# gqlgen [![Integration](https:\u002F\u002Fgithub.com\u002F99designs\u002Fgqlgen\u002Factions\u002Fworkflows\u002Fintegration.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002F99designs\u002Fgqlgen\u002Factions) [![Coverage Status](https:\u002F\u002Fcoveralls.io\u002Frepos\u002Fgithub\u002F99designs\u002Fgqlgen\u002Fbadge.svg?branch=master)](https:\u002F\u002Fcoveralls.io\u002Fgithub\u002F99designs\u002Fgqlgen?branch=master) [![Go Report Card](https:\u002F\u002Fgoreportcard.com\u002Fbadge\u002Fgithub.com\u002F99designs\u002Fgqlgen)](https:\u002F\u002Fgoreportcard.com\u002Freport\u002Fgithub.com\u002F99designs\u002Fgqlgen) [![Go Reference](https:\u002F\u002Fpkg.go.dev\u002Fbadge\u002Fgithub.com\u002F99designs\u002Fgqlgen.svg)](https:\u002F\u002Fpkg.go.dev\u002Fgithub.com\u002F99designs\u002Fgqlgen) [![Read the Docs](https:\u002F\u002Fbadgen.net\u002Fbadge\u002Fdocs\u002Favailable\u002Fgreen)](http:\u002F\u002Fgqlgen.com\u002F)\n\n## What is gqlgen?\n\n[gqlgen](https:\u002F\u002Fgithub.com\u002F99designs\u002Fgqlgen) is a Go library for building GraphQL servers without any fuss.\u003Cbr\u002F>\n\n- **gqlgen is based on a Schema first approach** — You get to Define your API using the GraphQL [Schema Definition Language](http:\u002F\u002Fgraphql.org\u002Flearn\u002Fschema\u002F).\n- **gqlgen prioritizes Type safety** — You should never see `map[string]interface{}` here.\n- **gqlgen enables Codegen** — We generate the boring bits, so you can focus on building your app quickly.\n\nStill not convinced enough to use **gqlgen**? Compare **gqlgen** with other Go graphql [implementations](https:\u002F\u002Fgqlgen.com\u002Ffeature-comparison\u002F)\n\n## Quick start\n\n1. [Initialise a new go module](https:\u002F\u002Fgolang.org\u002Fdoc\u002Ftutorial\u002Fcreate-module)\n\n```shell\nmkdir example\ncd example\ngo mod init example\n```\n\n2. Add `github.com\u002F99designs\u002Fgqlgen` to your project, as a [tool dependency](https:\u002F\u002Fgo.dev\u002Fdoc\u002Fmodules\u002Fmanaging-dependencies#tools)\n\n```shell\ngo get -tool github.com\u002F99designs\u002Fgqlgen\n```\n\n3. Initialise gqlgen config and generate models\n\n```shell\ngo tool gqlgen init\n```\n\n4. Start the graphql server\n\n```shell\ngo run server.go\n```\n\nMore help to get started:\n\n- [Getting started tutorial](https:\u002F\u002Fgqlgen.com\u002Fgetting-started\u002F) - a comprehensive guide to help you get started\n- [Real-world examples](https:\u002F\u002Fgithub.com\u002F99designs\u002Fgqlgen\u002Ftree\u002Fmaster\u002F_examples) show how to create GraphQL applications\n- [Reference docs](https:\u002F\u002Fpkg.go.dev\u002Fgithub.com\u002F99designs\u002Fgqlgen) for the APIs\n\n## Reporting Issues\n\nIf you think you've found a bug, or something isn't behaving the way you think it should, please raise an [issue](https:\u002F\u002Fgithub.com\u002F99designs\u002Fgqlgen\u002Fissues) on GitHub.\n\n## Contributing\n\nWe welcome contributions, Read our [Contribution Guidelines](https:\u002F\u002Fgithub.com\u002F99designs\u002Fgqlgen\u002Fblob\u002Fmaster\u002FCONTRIBUTING.md) to learn more about contributing to **gqlgen**\n\n## Frequently asked questions\n\n### How do I prevent fetching child objects that might not be used?\n\nWhen you have nested or recursive schema like this:\n\n```graphql\ntype User {\n\tid: ID!\n\tname: String!\n\tfriends: [User!]!\n}\n```\n\nYou need to tell gqlgen that it should only fetch friends if the user requested it. There are two ways to do this:\n\n### Using Custom Models\n\nWrite a custom model that omits the friends field:\n\n```go\ntype User struct {\n  ID int\n  Name string\n}\n```\n\nAnd reference the model in `gqlgen.yml`:\n\n```yaml\n# gqlgen.yml\nmodels:\n  User:\n    model: github.com\u002Fyou\u002Fpkg\u002Fmodel.User # go import path to the User struct above\n```\n\n### Using Explicit Resolvers\n\nIf you want to keep using the generated model, mark the field as requiring a resolver explicitly in `gqlgen.yml` like this:\n\n```yaml\n# gqlgen.yml\nmodels:\n  User:\n    fields:\n      friends:\n        resolver: true # force a resolver to be generated\n```\n\nAfter doing either of the above and running generate we will need to provide a resolver for friends:\n\n```go\nfunc (r *userResolver) Friends(ctx context.Context, obj *User) ([]*User, error) {\n  \u002F\u002F select * from user where friendid = obj.ID\n  return friends,  nil\n}\n```\n\nYou can also use inline config with directives to achieve the same result\n\n```graphql\ndirective @goModel(\n\tmodel: String\n\tmodels: [String!]\n) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION\n\ndirective @goField(\n\tforceResolver: Boolean\n\tname: String\n\tomittable: Boolean\n\ttype: String\n  autoBindGetterHaser: Boolean\n  forceGenerate: Boolean\n\tbatch: Boolean\n) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION\n\ntype User @goModel(model: \"github.com\u002Fyou\u002Fpkg\u002Fmodel.User\") {\n\tid: ID! @goField(name: \"todoId\")\n\tfriends: [User!]! @goField(forceResolver: true)\n\t# When omit_resolver_fields is enabled, this field will still be generated in the struct\n\tdata: String! @goField(forceResolver: true, forceGenerate: true)\n}\n```\n\nThe field resolvers will be executed concurrently in separate goroutines. The degree of concurrency can be customized with the [`worker_limit` configuration attribute](https:\u002F\u002Fgqlgen.com\u002Fconfig\u002F).\n\n### Can I change the type of the ID from type String to Type Int?\n\nYes! You can by remapping it in config as seen below:\n\n```yaml\nmodels:\n  ID: # The GraphQL type ID is backed by\n    model:\n      - github.com\u002F99designs\u002Fgqlgen\u002Fgraphql.IntID # a go integer\n      - github.com\u002F99designs\u002Fgqlgen\u002Fgraphql.ID # or a go string\n      - github.com\u002F99designs\u002Fgqlgen\u002Fgraphql.UintID # or a go uint\n```\n\nThis means gqlgen will be able to automatically bind to strings or ints for models you have written yourself, but the\nfirst model in this list is used as the default type and it will always be used when:\n\n- Generating models based on schema\n- As arguments in resolvers\n\nThere isn't any way around this, gqlgen has no way to know what you want in a given context.\n\n### Why do my interfaces have getters? Can I disable these?\n\nThese were added in v0.17.14 to allow accessing common interface fields without casting to a concrete type.\nHowever, certain fields, like Relay-style Connections, cannot be implemented with simple getters.\n\nIf you'd prefer to not have getters generated in your interfaces, you can add the following in your `gqlgen.yml`:\n\n```yaml\n# gqlgen.yml\nomit_getters: true\n```\n\n## Other Resources\n\n- [Christopher Biscardi @ Gophercon UK 2018](https:\u002F\u002Fyoutu.be\u002FFdURVezcdcw)\n- [Introducing gqlgen: a GraphQL Server Generator for Go](https:\u002F\u002F99designs.com.au\u002Fblog\u002Fengineering\u002Fgqlgen-a-graphql-server-generator-for-go\u002F)\n- [Dive into GraphQL by Iván Corrales Solera](https:\u002F\u002Fmedium.com\u002F@ivan.corrales.solera\u002Fdive-into-graphql-9bfedf22e1a)\n- [Sample Project built on gqlgen with Postgres by Oleg Shalygin](https:\u002F\u002Fgithub.com\u002Foshalygin\u002Fgqlgen-pg-todo-example)\n- [Hackernews GraphQL Server with gqlgen by Shayegan Hooshyari](https:\u002F\u002Fwww.howtographql.com\u002Fgraphql-go\u002F0-introduction\u002F)\n","gqlgen 是一个基于 Go 语言的 GraphQL 服务器库，旨在简化 GraphQL 服务端开发。它采用模式优先的方法，允许开发者使用 GraphQL 的 Schema Definition Language 定义 API；强调类型安全，避免了常见的 `map[string]interface{}` 类型问题；并支持代码生成，自动生成模板代码以加速开发过程。此项目非常适合需要快速构建稳定且易于维护的 GraphQL 服务的应用场景，如微服务架构下的数据聚合层或客户端与后端之间的高效通信接口。",2,"2026-06-11 03:02:08","top_language"]