Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Block ¶
type Block interface {
// contains filtered or unexported methods
}
Block builder that can be materialized
type File ¶
type File interface { Statement // GoFmt - manage go-fmt before write file. By default, it is enabled. GoFmt(enabled bool) File // GoImports - formats and adjusts imports for the provided file. By default, it is disabled. GoImports(enabled bool) File // GeneratedBy - add special comment to identify generated file. GeneratedBy(tool string) // Package - add this file package name. Package(pkg string) // Import - add import with optional alias. Import(alias, path string) // Add - add a code block. Add(b Block) // Vars - add vars to `var` block. Vars(s ...Statement) // Consts - add consts to `const` block. Consts(s ...Statement) // Output - file as raw bytes. Output() ([]byte, error) // Write - write output or dest io.Writer. Write(dest io.Writer) error // Create - create new file or rewrite existing. Create(fileName string) error }
File builder for files
type Function ¶
type Function interface { Block // Name function name. Name(name string) Function // Params function params. Params(params ...string) Function // Returns function return values. Returns(results ...string) Function // Body function body. Body(body ...Statement) Function }
Function builder for free functions
type Statement ¶
type Statement interface { fmt.Stringer Block // Print prints statement to inner buffer. Print(s string, args ...interface{}) Statement // Line add line with args. Line(s string, args ...interface{}) Statement NewLine() Statement }
Statement builder, that can build any statement.
type Type ¶
type Type interface { Block // Name type name. Name(name string) Type // Is type redeclaration. Is(anotherType string) Type // Struct type as struct. Struct(fields ...Statement) Type // Interface type as interface. Interface(methods ...Function) Type }
Type builder for types and interfaces
Click to show internal directories.
Click to hide internal directories.