Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Action

func Action(ctx context.Context, c *cli.Command) error

Action 重构后的API命令,支持protobuf解析

Types

type CodeGenerationService

type CodeGenerationService struct {
	// contains filtered or unexported fields
}

CodeGenerationService 代码生成服务

func NewCodeGenerationService

func NewCodeGenerationService() *CodeGenerationService

NewCodeGenerationService 创建代码生成服务

func (*CodeGenerationService) GenerateFromAPISpec

func (s *CodeGenerationService) GenerateFromAPISpec(ctx context.Context, spec *generator.APISpec, options *GenerateOptions) error

GenerateFromAPISpec 从API规范生成代码

func (*CodeGenerationService) GenerateFromProtobuf

func (s *CodeGenerationService) GenerateFromProtobuf(ctx context.Context, files []*ast.ProtobufFile, options *GenerateOptions) error

GenerateFromProtobuf 从protobuf文件生成代码

type GenerateOptions

type GenerateOptions struct {
	OutputDir     string
	ModuleName    string
	GenerateTypes []string
	Features      []string
	Verbose       bool
	DryRun        bool
}

GenerateOptions 生成选项

func NewGenerateOptions

func NewGenerateOptions() *GenerateOptions

NewGenerateOptions 创建生成选项

func (*GenerateOptions) GetAbsoluteOutputDir

func (o *GenerateOptions) GetAbsoluteOutputDir(projectPath string) string

GetAbsoluteOutputDir 获取绝对输出目录

func (*GenerateOptions) SetDryRun

func (o *GenerateOptions) SetDryRun(dryRun bool) *GenerateOptions

SetDryRun 设置试运行模式

func (*GenerateOptions) SetFeatures

func (o *GenerateOptions) SetFeatures(features []string) *GenerateOptions

SetFeatures 设置特性

func (*GenerateOptions) SetGenerateTypes

func (o *GenerateOptions) SetGenerateTypes(types []string) *GenerateOptions

SetGenerateTypes 设置生成类型

func (*GenerateOptions) SetModuleName

func (o *GenerateOptions) SetModuleName(name string) *GenerateOptions

SetModuleName 设置模块名

func (*GenerateOptions) SetOutputDir

func (o *GenerateOptions) SetOutputDir(dir string) *GenerateOptions

SetOutputDir 设置输出目录

func (*GenerateOptions) SetVerbose

func (o *GenerateOptions) SetVerbose(verbose bool) *GenerateOptions

SetVerbose 设置详细模式

func (*GenerateOptions) Validate

func (o *GenerateOptions) Validate() error

Validate 验证选项

Jump to

Keyboard shortcuts

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