Documentation ¶
Index ¶
- type Generator
- func (g *Generator) AccessFunc(typ *ast.TypeSpec, field *ast.Field, imp []*ast.ImportSpec)
- func (g *Generator) File(file *ast.File)
- func (g *Generator) Generate() string
- func (g *Generator) Import(imp *ast.ImportSpec)
- func (g *Generator) Imports(imp []*ast.ImportSpec)
- func (g *Generator) Line()
- func (g *Generator) Type(typ *ast.TypeSpec)
- func (g *Generator) WithFunc(typ *ast.TypeSpec, field *ast.Field, imp []*ast.ImportSpec)
- type GeneratorOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
func NewGenerator ¶
func NewGenerator(opts GeneratorOpts) *Generator
NewGenerator creates a new generator configured by the given GeneratorOpts.
func (*Generator) AccessFunc ¶
AccessFunc generates the code for the function used to access a field.
func (*Generator) Import ¶
func (g *Generator) Import(imp *ast.ImportSpec)
Import generates the code for the given import spec.
func (*Generator) Imports ¶
func (g *Generator) Imports(imp []*ast.ImportSpec)
Imports generates the code for the given import specs.
func (*Generator) Line ¶
func (g *Generator) Line()
Line inserts an empty line into the generated code.
type GeneratorOpts ¶
type GeneratorOpts struct { // Package is the name of the package to generate the code in. Package string `json:"package,omitempty"` // StructTag is the name of the struct tag to use for accessing the value // of the field in the partial type's helper methods. StructTag string `json:"structTag,omitempty"` // TypePrefix is the prefix to use for the generated partial types. TypePrefix string `json:"typePrefix,omitempty"` }
Click to show internal directories.
Click to hide internal directories.