Skip to content

plugins used in the gqlgen code generation lifecycle

License

Notifications You must be signed in to change notification settings

evangrayson/gqlgen-plugins

 
 

Repository files navigation

Go Report Card Build status Quality Gate Status License: Apache 2.0

gqlgen-plugins

gqlgen 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:

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)
	}
}

About

plugins used in the gqlgen code generation lifecycle

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%