modelgen

package
v0.17.18 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 10 Imported by: 95

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() plugin.Plugin

Types

type BuildMutateHook added in v0.10.2

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
}

func GoTagFieldHook added in v0.15.0

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

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

type FieldMutateHook added in v0.15.0

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
}

type ModelBuild

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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