{"id":13514202,"url":"https://github.com/Yamashou/gqlgenc","last_synced_at":"2025-03-31T02:33:35.479Z","repository":{"id":37934226,"uuid":"272183214","full_name":"Yamashou/gqlgenc","owner":"Yamashou","description":"This is Go library for building GraphQL client with gqlgen","archived":false,"fork":false,"pushed_at":"2025-02-23T13:00:21.000Z","size":10889,"stargazers_count":376,"open_issues_count":8,"forks_count":71,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-28T14:03:22.333Z","etag":null,"topics":["go","golang","graphql"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Yamashou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-14T10:54:35.000Z","updated_at":"2025-03-24T16:12:14.000Z","dependencies_parsed_at":"2023-09-25T05:28:22.184Z","dependency_job_id":"8da927af-c3bc-44a2-9986-3474ad3a4db5","html_url":"https://github.com/Yamashou/gqlgenc","commit_stats":{"total_commits":366,"total_committers":39,"mean_commits":9.384615384615385,"dds":"0.44535519125683065","last_synced_commit":"29e23279e6dad413e08f7dd1390dda831cf0e6e7"},"previous_names":[],"tags_count":75,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yamashou%2Fgqlgenc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yamashou%2Fgqlgenc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yamashou%2Fgqlgenc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yamashou%2Fgqlgenc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yamashou","download_url":"https://codeload.github.com/Yamashou/gqlgenc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246407403,"owners_count":20772127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","graphql"],"created_at":"2024-08-01T05:00:49.517Z","updated_at":"2025-03-31T02:33:30.469Z","avatar_url":"https://github.com/Yamashou.png","language":"Go","funding_links":[],"categories":["Go","Command line"],"sub_categories":["Generator"],"readme":"# gqlgenc\n\n## What is gqlgenc ?\n\nThis is Go library for building GraphQL client with [gqlgen](https://github.com/99designs/gqlgen)\n\n## Motivation\n\nNow, if you build GraphQL api client for Go, have choice:\n\n - [github.com/shurcooL/graphql](https://github.com/shurcooL/graphql)\n - [github.com/machinebox/graphql](https://github.com/machinebox/graphql)\n\nThese libraries are very simple and easy to handle.\nHowever, as I work with [gqlgen](https://github.com/99designs/gqlgen) and [graphql-code-generator](https://graphql-code-generator.com/) every day, I find out the beauty of automatic generation.\nSo I want to automatically generate types.\n\n## Installation\n\n```shell script\ngo get -u github.com/Yamashou/gqlgenc\n```\n\n## How to use\n\n### Client Codes Only\n\ngqlgenc base is gqlgen with [plugins](https://gqlgen.com/reference/plugins/). So the setting is yaml in each format.\ngqlgenc can be configured using a `.gqlgenc.yml` file\n\nLoad a schema from a remote server:\n\n```yaml\nmodel:\n  package: generated\n  filename: ./models_gen.go # https://github.com/99designs/gqlgen/tree/master/plugin/modelgen\nclient:\n  package: generated\n  filename: ./client.go # Where should any generated client go?\nmodels:\n  Int:\n    model: github.com/99designs/gqlgen/graphql.Int64\n  Date:\n    model: github.com/99designs/gqlgen/graphql.Time\nfederation: # Add this if your schema includes Apollo Federation related directives\n  version: 2\nendpoint:\n  url: https://api.annict.com/graphql # Where do you want to send your request?\n  headers: # If you need header for getting introspection query, set it\n    Authorization: \"Bearer ${ANNICT_KEY}\" # support environment variables\nquery:\n  - \"./query/*.graphql\" # Where are all the query files located?\ngenerate:\n  clientInterfaceName: \"GithubGraphQLClient\" # Determine the name of the generated client interface\n  structFieldsAlwaysPointers: true # Always use pointers for struct fields (default: true)  [same as gqlgen](https://github.com/99designs/gqlgen/blob/e1ef86e795e738654c98553b325a248c02c8c2f8/docs/content/config.md?plain=1#L73)\n```\n\nLoad a schema from a local file:\n\n```yaml\nmodel:\n  package: generated\n  filename: ./models_gen.go # https://github.com/99designs/gqlgen/tree/master/plugin/modelgen\nclient:\n  package: generated\n  filename: ./client.go # Where should any generated client go?\nmodels:\n  Int:\n    model: github.com/99designs/gqlgen/graphql.Int64\n  Date:\n    model: github.com/99designs/gqlgen/graphql.Time\nfederation: # Add this if your schema includes Apollo Federation related directives\n  version: 2\nschema:\n  - \"schema/**/*.graphql\" # Where are all the schema files located?\nquery:\n  - \"./query/*.graphql\" # Where are all the query files located?\ngenerate:\n  clientInterfaceName: \"GithubGraphQLClient\" # Determine the name of the generated client interface\n  structFieldsAlwaysPointers: true # Optional: Always use pointers for struct fields (default: true). [same as gqlgen](https://github.com/99designs/gqlgen/blob/e1ef86e795e738654c98553b325a248c02c8c2f8/docs/content/config.md?plain=1#L73)\n```\n\nExecute the following command on same directory for .gqlgenc.yml\n\n```shell script\ngqlgenc\n```\n\nor if you want to specify a different directory where .gqlgenc.yml file resides\n(e.g. in this example the directory is *schemas*):\n\n```shell script\ngqlgenc generate --configdir schemas\n```\n\n### With gqlgen\n\nDo this when creating a server and client for Go.\nYou create your own entrypoint for gqlgen.\nThis use case is very useful for testing your server.\n\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/Yamashou/gqlgenc/clientgenv2\"\n\n\t\"github.com/99designs/gqlgen/api\"\n\t\"github.com/99designs/gqlgen/codegen/config\"\n)\n\nfunc main() {\n\tcfg, err := config.LoadConfigFromDefaultLocations()\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, \"failed to load config\", err.Error())\n\t\tos.Exit(2)\n\t}\n\tqueries := []string{\"client.query\", \"fragemt.query\"}\n\tclientPackage := config.PackageConfig{\n\t\tFilename: \"./client.go\",\n\t\tPackage:  \"gen\",\n\t}\n\n\tclientPlugin := clientgenv2.New(queries, clientPackage, nil)\n\terr = api.Generate(cfg,\n\t\tapi.AddPlugin(clientPlugin),\n\t)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, err.Error())\n\t\tos.Exit(3)\n\t}\n}\n```\n\n## Documents\n\n- [How to configure gqlgen using gqlgen.yml](https://gqlgen.com/config/)\n- [How to write plugins for gqlgen](https://gqlgen.com/reference/plugins/)\n\n\n## Comments\n\n### Japanese Comments\nThese codes have Japanese comments. Replace with English.\n\n### Subscription\n\nThis client does not support subscription. If you need a subscription, please create an issue or pull request.\n\n### Pre-conditions\n\n[clientgenv2](https://github.com/Yamashou/gqlgenc/tree/master/clientgenv2) is created based on [modelgen](https://github.com/99designs/gqlgen/tree/master/plugin/modelgen). So if you don't have a modelgen, it may be a mysterious move.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYamashou%2Fgqlgenc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FYamashou%2Fgqlgenc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYamashou%2Fgqlgenc/lists"}