resolvergen

package
v0.14.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package resolvergen provides the a resolver template for the gqlgen resolver plugin to override the default resolver functions

Index

Constants

View Source
const (
	CreateOperation  = "Create"
	UpdateOperation  = "Update"
	AddOperation     = "Add"
	DeleteOperation  = "Delete"
	InputObject      = "Input"
	BulkOperation    = "Bulk"
	CSVOperation     = "CSV"
	BulkCSVOperation = "BulkCSV"
	UploadOperation  = "Upload"
	Connection       = "Connection"
	Payload          = "Payload"
)

Variables

View Source
var ErrGraphResolverDirRequired = errors.New("graphResolverDir is required")

ErrGraphResolverDirRequired is returned when UpdateWorkflowResolvers is called without a directory

View Source
var ErrModuleRootNotFound = errors.New("unable to determine module root")

ErrModuleRootNotFound is returned when the module root cannot be determined from import paths or go.mod

Functions

func UpdateWorkflowResolvers added in v0.13.4

func UpdateWorkflowResolvers(graphResolverDir string) error

UpdateWorkflowResolvers generates shared workflow resolver helper implementations when workflow fields are present in resolver files.

Types

type Options added in v0.4.8

type Options func(*ResolverPlugin)

Options is a function to set the options for the plugin

func WithArchivableSchemas added in v0.7.1

func WithArchivableSchemas(schemas []string) Options

WithArchivableSchemas sets schemas that can have a status of archived

func WithCSVGeneratedPackage added in v0.14.0

func WithCSVGeneratedPackage(pkg string) Options

WithCSVGeneratedPackage sets the import path for the csvgenerated package

func WithEntGeneratedPackage added in v0.4.8

func WithEntGeneratedPackage(entPackage string) Options

WithEntGeneratedPackage sets the ent generated package for imports

func WithExcludeCustomUpdateFields added in v0.4.9

func WithExcludeCustomUpdateFields() Options

WithExcludeCustomUpdateFields excludes custom resolver fields for updates resolvers

func WithForceRegenerateBulkResolvers added in v0.14.0

func WithForceRegenerateBulkResolvers(enabled bool) Options

WithForceRegenerateBulkResolvers enables forced regeneration of bulk resolver implementations, overwriting any existing custom logic. Use this for one-time migrations when bulk templates change, then disable to preserve customizations.

func WithGraphQLImport added in v0.13.0

func WithGraphQLImport(graphqlImport string) Options

WithGraphQLImport sets the import path for the graphql package

type ResolverPlugin

type ResolverPlugin struct {
	*resolvergen.Plugin
	// contains filtered or unexported fields
}

ResolverPlugin is a gqlgen plugin to generate resolver functions

func New

func New() *ResolverPlugin

New returns a new resolver plugin

func NewWithOptions added in v0.4.8

func NewWithOptions(opts ...Options) *ResolverPlugin

NewWithOptions returns a new plugin with the given options

func (*ResolverPlugin) GenerateCode

func (r *ResolverPlugin) GenerateCode(data *codegen.Data) error

GenerateCode implements api.CodeGenerator

func (*ResolverPlugin) Implement

func (r *ResolverPlugin) Implement(s string, f *codegen.Field) (val string)

Implement gqlgen api.ResolverImplementer

func (ResolverPlugin) Name

func (r ResolverPlugin) Name() string

Name returns the name of the plugin This name must match the upstream resolvergen to replace during code generation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL