Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct { Name string // The name of the field. TypeName string //string representation of the Go Type of the field Tags map[string]StructTag }
Value represents a struct field
type File ¶
type File struct {
// contains filtered or unexported fields
}
File holds a single parsed file and associated data.
type Generator ¶
type Generator struct { Buf bytes.Buffer // Accumulated output. // contains filtered or unexported fields }
Generator holds the state of the analysis. Primarily used to buffer the output for format.Source.
func (*Generator) Run ¶
func (g *Generator) Run(pathArgs []string, typeName string, outputName string, genFn GeneratorFunc) error
Run parses the target package and generates the code, verifying the package before and after generation. pathArgs is a list of file paths, to either individual files or whole directories. typeName is the name of a struct we're working on. outputName is where the generated code should go. genFn is the most important part, and recieves all the meta info about the targeted Type
type GeneratorFunc ¶
The caller will send a function of this type to do all the actual modification of the target package