service

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(ctx context.Context, opts GeneratorOptions) error

Generate 生成服务脚手架代码

Types

type Generator

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

Generator 服务代码生成器

func NewGenerator

func NewGenerator() *Generator

NewGenerator 创建服务代码生成器

func (*Generator) Generate

func (g *Generator) Generate(_ context.Context, opts GeneratorOptions) error

Generate 执行服务代码生成

type GeneratorOptions

type GeneratorOptions struct {
	OutputPath string

	ProjectModule string
	ProjectName   string
	ServiceName   string

	Servers   []string
	DbClients []string

	// UseWireDI 为真时生成旧式 wire 依赖注入(wire.go + 各层 providers/wire_set.go),
	// 与既有 wire 工程向下兼容;默认为假,生成手写装配文件(cmd/server/wiring.go)。
	UseWireDI bool

	GenerateServer   bool
	GenerateService  bool
	GenerateData     bool
	GenerateMain     bool
	GenerateMakefile bool
	GenerateConfigs  bool
}

GeneratorOptions 保存代码生成器的选项。

func (GeneratorOptions) HasBFFService

func (o GeneratorOptions) HasBFFService() bool

HasBFFService checks whether the BFF (Backend For Frontend) service is included in the generator options.

Jump to

Keyboard shortcuts

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