Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
Field contains the parsed metadata about a struct field, like it's Name and a map of it's Tags.
type StructData ¶
type StructData struct { Name string // the name of the struct we're looking for PkgImportPath string // the import path for this type File *ast.File // parsed file containing our struct def Fields []Field // the fields def }
StructData contains data about this struct that is used during the code generation, such as the struct name and package name such that we could generate things like
package foo type BarSearchRequest struct { // ... }
StructData also collects the Fields contained with the struct such that we can generate a list of fields that are approved for search or create or update requests like
type BarField int const ( Baz BarField = iota Boom Biff Bang )
func GatherStructData ¶
func GatherStructData(structName string) (*StructData, error)
GatherStructData finds the correct file containing the struct in question, parses out the pertinents, and then returns the struct data to be used for generating files.
Click to show internal directories.
Click to hide internal directories.