Documentation
¶
Index ¶
- func CombineOutputPath(outputPath, ns string) string
- func Debug(format string, a ...any)
- func Main(handler Handler, mainOptions ...Option)
- func Run(ctx context.Context, env Env, handler Handler, runOptions ...Option) error
- type CodeGeneratorRequest
- type CodeGeneratorResponse
- type Env
- type Handler
- type HandlerFunc
- type Option
- type PluginEnv
- type ReplaceImportDesc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombineOutputPath ¶ added in v0.1.15
Types ¶
type CodeGeneratorRequest ¶ added in v0.1.1
type CodeGeneratorRequest interface { // RawRequest returns raw thriftgo plugin request RawRequest() *tplugin.Request // CodeUtils returns golang code utils // CodeUtils returns golang code utils CodeUtils() *golang.CodeUtils // GetOutputPath returns output path GetOutputPath() string // Ast returns thrift ast Ast() *parser.Thrift // GetReplaceImportDesc returns replace import desc GetReplaceImportDesc() []ReplaceImportDesc // GetSameBatchFiles returns all same batch files, // you can choose to generate these files by yourself. // Notes: it includes all thrift files (include the current file). GetSameBatchFiles() []string }
CodeGeneratorRequest is thriftgo plugin request
type CodeGeneratorResponse ¶ added in v0.1.1
type CodeGeneratorResponse interface { // AddFile add file to response AddFile(name, content string) // AddError add error to response AddError(message string) // AddWarning add warning to response AddWarning(message ...string) // AddCodeGeneratorResponseFiles add code generator response files to response AddCodeGeneratorResponseFiles(files ...*tplugin.Generated) // RawResponse returns raw thriftgo plugin response RawResponse() *tplugin.Response }
CodeGeneratorResponse is thriftgo plugin response
type Handler ¶ added in v0.1.1
type Handler interface {
Handle(context.Context, PluginEnv, CodeGeneratorRequest, CodeGeneratorResponse) error
}
type HandlerFunc ¶ added in v0.1.1
type HandlerFunc func(context.Context, PluginEnv, CodeGeneratorRequest, CodeGeneratorResponse) error
func (HandlerFunc) Handle ¶ added in v0.1.1
func (f HandlerFunc) Handle(ctx context.Context, env PluginEnv, req CodeGeneratorRequest, res CodeGeneratorResponse) error
type Option ¶ added in v0.1.1
type Option func(opts *options)
func WithHelpFunc ¶ added in v0.1.6
func WithHelpFunc(helpFunc func()) Option
WithHelpFunc sets the help function for the plugin.
func WithParamFunc ¶ added in v0.1.1
WithParamFunc sets the parameter function for the plugin. eg: flag.Set or pflag.Set
func WithVersion ¶ added in v0.1.1
WithVersion sets the version for the plugin.
Click to show internal directories.
Click to hide internal directories.