package modelgen

import "github.com/99designs/gqlgen/plugin/modelgen"

Index

Functions

func New

func New() plugin.Plugin

Types

type BuildMutateHook

type BuildMutateHook = func(b *ModelBuild) *ModelBuild

type Enum

type Enum struct {
	Description string
	Name        string
	Values      []*EnumValue
}

type EnumValue

type EnumValue struct {
	Description string
	Name        string
}

type Field

type Field struct {
	Description string
	// Name is the field's name as it appears in the schema
	Name string
	// GoName is the field's name as it appears in the generated Go code
	GoName     string
	Type       types.Type
	Tag        string
	IsResolver bool
	Omittable  bool
}

func DefaultFieldMutateHook

func DefaultFieldMutateHook(td *ast.Definition, fd *ast.FieldDefinition, f *Field) (*Field, error)

DefaultFieldMutateHook is the default hook for the Plugin which applies the GoFieldHook and GoTagFieldHook.

func GoFieldHook

func GoFieldHook(td *ast.Definition, fd *ast.FieldDefinition, f *Field) (*Field, error)

GoFieldHook is a noop TODO: This will be removed in the next breaking release

func GoTagFieldHook

func GoTagFieldHook(td *ast.Definition, fd *ast.FieldDefinition, f *Field) (*Field, error)

GoTagFieldHook prepends the goTag directive to the generated Field f. When applying the Tag to the field, the field name is used if no value argument is present.

type FieldMutateHook

type FieldMutateHook = func(td *ast.Definition, fd *ast.FieldDefinition, f *Field) (*Field, error)

type Interface

type Interface struct {
	Description string
	Name        string
	Fields      []*Field
	Implements  []string
	OmitCheck   bool
	Models      []*Object
}

type ModelBuild

type ModelBuild struct {
	PackageName string
	Interfaces  []*Interface
	Models      []*Object
	Enums       []*Enum
	Scalars     []string
}

func DefaultBuildMutateHook

func DefaultBuildMutateHook(b *ModelBuild) *ModelBuild

DefaultBuildMutateHook is the default hook for the Plugin which mutate ModelBuild.

type Object

type Object struct {
	Description string
	Name        string
	Fields      []*Field
	Implements  []string
}

type Plugin

type Plugin struct {
	MutateHook BuildMutateHook
	FieldHook  FieldMutateHook
}

func (*Plugin) MutateConfig

func (m *Plugin) MutateConfig(cfg *config.Config) error

func (*Plugin) Name

func (m *Plugin) Name() string

Source Files

models.go types.go

Directories

PathSynopsis
plugin/modelgen/internal
plugin/modelgen/out
plugin/modelgen/out_enable_model_json_omitempty_tag_false
plugin/modelgen/out_enable_model_json_omitempty_tag_false_omitempty_tag_false_omitzero_tag_nil
plugin/modelgen/out_enable_model_json_omitempty_tag_false_omitempty_tag_false_omitzero_tag_true
plugin/modelgen/out_enable_model_json_omitempty_tag_false_omitzero_tag_false
plugin/modelgen/out_enable_model_json_omitempty_tag_false_omitzero_tag_nil
plugin/modelgen/out_enable_model_json_omitempty_tag_false_omitzero_tag_true
plugin/modelgen/out_enable_model_json_omitempty_tag_nil
plugin/modelgen/out_enable_model_json_omitempty_tag_true
plugin/modelgen/out_enable_model_json_omitzero_tag_false
plugin/modelgen/out_enable_model_json_omitzero_tag_nil
plugin/modelgen/out_enable_model_json_omitzero_tag_true
plugin/modelgen/out_nullable_input_omittable
plugin/modelgen/out_omit_resolver_fields
plugin/modelgen/out_struct_pointers
Version
v0.17.73 (latest)
Published
May 2, 2025
Platform
linux/amd64
Imports
11 packages
Last checked
6 days ago

Tools for package owners.