Documentation
¶
Index ¶
Constants ¶
View Source
const Needs = packages.NeedName | packages.NeedDeps | packages.NeedFiles | packages.NeedSyntax | packages.NeedImports
Needs is the packages.Mode with all the flags required to find fields.
Variables ¶
This section is empty.
Functions ¶
func ResolvePackage ¶
ResolvePackage will resolve a package by its name. It's legal to pass a nil file, but then import aliases and duplicates are not handled.
func ResolveType ¶
ResolveType returns a struct type defined in the provided package along with the file it's declared in. The bool return value will be false if the name could not be resolved.
Types ¶
type StructType ¶
StructType contains details about a struct and it's fields.
func Load ¶
func Load(dir string, patterns ...string) ([]*StructType, error)
Load finds all structs in the packages specified in the patterns. Embeded fields are treated the same as regular fields.
func Structs ¶
func Structs(pkg *packages.Package) []*StructType
Structs finds all structs in the provided package. Embeded fields are treated the same as regular fields.
Click to show internal directories.
Click to hide internal directories.