Documentation
¶
Overview ¶
Package codegen contains helpers for code generation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Inspector ¶
type Inspector struct {
ProjectRootDir string
// contains filtered or unexported fields
}
Inspector provides methods to help code generation. It uses a combination of reflection and source code AST to do the heavy lifting.
func NewInspector ¶
NewInspector creates a new Inspector given a source root.
type Method ¶
type Method struct {
// The interface we extracted this method from.
Owner reflect.Type
// String version of the above, on the form PACKAGE.NAME, e.g.
// page.Page
OwnerName string
// Method name.
Name string
// Imports needed to satisfy the method signature.
Imports []string
// Argument types, including any package prefix, e.g. string, int, interface{},
// net.Url
In []string
// Return types.
Out []string
}
Method holds enough information about it to recreate it.
func (Method) Declaration ¶
Declaration creates a method declaration (without any body) for the given receiver.
func (Method) DeclarationNamed ¶
DeclarationNamed creates a method declaration (without any body) for the given receiver with named return values.
Click to show internal directories.
Click to hide internal directories.