Documentation
¶
Overview ¶
Package resolvergen provides the a resolver template for the gqlgen resolver plugin to override the default resolver functions
Index ¶
- Constants
- Variables
- func UpdateWorkflowResolvers(graphResolverDir string) error
- type Options
- func WithArchivableSchemas(schemas []string) Options
- func WithCSVGeneratedPackage(pkg string) Options
- func WithEntGeneratedPackage(entPackage string) Options
- func WithExcludeCustomUpdateFields() Options
- func WithForceRegenerateBulkResolvers(enabled bool) Options
- func WithGraphQLImport(graphqlImport string) Options
- type ResolverPlugin
Constants ¶
const ( CreateOperation = "Create" UpdateOperation = "Update" AddOperation = "Add" DeleteOperation = "Delete" InputObject = "Input" BulkOperation = "Bulk" CSVOperation = "CSV" BulkCSVOperation = "BulkCSV" UploadOperation = "Upload" Connection = "Connection" Payload = "Payload" )
Variables ¶
var ErrGraphResolverDirRequired = errors.New("graphResolverDir is required")
ErrGraphResolverDirRequired is returned when UpdateWorkflowResolvers is called without a directory
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
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
WithArchivableSchemas sets schemas that can have a status of archived
func WithCSVGeneratedPackage ¶ added in v0.14.0
WithCSVGeneratedPackage sets the import path for the csvgenerated package
func WithEntGeneratedPackage ¶ added in v0.4.8
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
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
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 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