Documentation ¶
Overview ¶
Package generator contains the generator implementation that manages backends. New backend must implement the backend.Backend interface and be registered into the Generator instance before using.
Index ¶
- type Arguments
- type FileManager
- type Generator
- func (g *Generator) AllBackend() []backend.Backend
- func (g *Generator) Generate(args *Arguments) (res *plugin.Response)
- func (g *Generator) GetBackend(name string) backend.Backend
- func (g *Generator) Name() string
- func (g *Generator) Persist(res *plugin.Response) error
- func (g *Generator) RegisterBackend(b backend.Backend) error
- type LangSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileManager ¶
type FileManager struct {
// contains filtered or unexported fields
}
FileManager manages in-memory files that used during the code generation process.
func NewFileManager ¶
func NewFileManager(log backend.LogFunc) *FileManager
NewFileManager creates a new FileManager.
func (*FileManager) BuildResponse ¶
func (fm *FileManager) BuildResponse() *plugin.Response
BuildResponse creates a plugin.Response containing all files that the FileManager manages. All insertion points will be removed after the response is built.
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator controls the code generation. The zero value of Generator is ready for use.
func (*Generator) AllBackend ¶
AllBackend returns all registered backends.
func (*Generator) Generate ¶
Generate generates codes for the target language and executes plugins specified.
func (*Generator) GetBackend ¶
GetBackend returns a backend of the language.
Directories ¶
Path | Synopsis |
---|---|
Package backend defines the Backend interface for generators.
|
Package backend defines the Backend interface for generators. |
Package golang is the generator backend for golang.
|
Package golang is the generator backend for golang. |
extension/unknown
Package unknown .
|
Package unknown . |
templates
Package templates defines templates for generating golang codes.
|
Package templates defines templates for generating golang codes. |