Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/theopenlane/gqlgen-plugins
plugins used in the gqlgen code generation lifecycle
https://github.com/theopenlane/gqlgen-plugins
codegen gqlgen gqlgen-hooks graphql
Last synced: about 1 month ago
JSON representation
plugins used in the gqlgen code generation lifecycle
- Host: GitHub
- URL: https://github.com/theopenlane/gqlgen-plugins
- Owner: theopenlane
- License: apache-2.0
- Created: 2024-08-25T22:14:45.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-09-26T20:15:34.000Z (about 2 months ago)
- Last Synced: 2024-09-27T02:42:26.046Z (about 2 months ago)
- Topics: codegen, gqlgen, gqlgen-hooks, graphql
- Language: Go
- Homepage:
- Size: 73.2 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[![Go Report Card](https://goreportcard.com/badge/github.com/theopenlane/gqlgen-plugins)](https://goreportcard.com/report/github.com/theopenlane/gqlgen-plugins)
[![Build status](https://badge.buildkite.com/651bd9d2d92df64fcab6bab5db1842565d29c48ade77b52bd7.svg)](https://buildkite.com/theopenlane/gqlgen-plugins?branch=main)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=theopenlane_gqlgen-plugins&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=theopenlane_gqlgen-plugins)
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache2.0-brightgreen.svg)](https://opensource.org/licenses/Apache-2.0)# gqlgen-plugins
[gqlgen](https://gqlgen.com/reference/plugins/) provides a way to hook into the gqlgen code generation lifecycle. This repo contains two hooks:
- bulkgen
- resovlergen## ResolverGen
This hook will override the default generated resolver functions with the templates for CRUD operations.
## BulkGen
Creates resolvers to do bulk operations for a schema for both bulk input or a csv file upload input.
## Usage
Add the plugins to the `generate.go` `main` function to be included in the setup:
```go
func main() {
cfg, err := config.LoadConfigFromDefaultLocations()
if err != nil {
fmt.Fprintln(os.Stderr, "failed to load config", err.Error())
os.Exit(2)
}if err := api.Generate(cfg,
api.ReplacePlugin(resolvergen.New()), // replace the resolvergen plugin
api.AddPlugin(bulkgen.New()), // add the bulkgen plugin
); err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(3)
}
}
```