generator

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2021 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arguments

type Arguments struct {
	Out *LangSpec
	Req *plugin.Request
	Log backend.LogFunc
}

Arguments contains arguments for generator's Generate method.

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.

func (*FileManager) Feed

func (fm *FileManager) Feed(src string, files []*plugin.Generated) error

Feed adds files to the FileManager.

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

func (g *Generator) AllBackend() []backend.Backend

AllBackend returns all registered backends.

func (*Generator) Generate

func (g *Generator) Generate(args *Arguments) (res *plugin.Response)

Generate generates codes for the target language and executes plugins specified.

func (*Generator) GetBackend

func (g *Generator) GetBackend(name string) backend.Backend

GetBackend returns a backend of the language.

func (*Generator) Name

func (g *Generator) Name() string

Name returns "thriftgo".

func (*Generator) Persist

func (g *Generator) Persist(res *plugin.Response) error

Persist writes generated files into the disk. Each files in the Contents slice must have a legal name.

func (*Generator) RegisterBackend

func (g *Generator) RegisterBackend(b backend.Backend) error

RegisterBackend adds a backend to the generator.

type LangSpec

type LangSpec struct {
	Language    string
	Options     []plugin.Option
	UsedPlugins []*plugin.Desc
}

LangSpec is the parameter to specify which langauge to generate codes for and what plugins should be used.

Directories

Path Synopsis
extension/unknown
Package unknown provides definitions that work with the thriftgo `keep_unknown_fields` option.
Package unknown provides definitions that work with the thriftgo `keep_unknown_fields` option.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL