Documentation
¶
Index ¶
- func AddMiddlewareLine(targetDir, line string) error
- func AddRouteLine(targetDir, routeLine, routeLabel string) error
- func AppendEnvValue(targetDir, line string) error
- func CommonBaseFiles() map[string]string
- func DetectModulePath(targetDir string) (string, error)
- func EnsureImport(path, anchor, importLine string) error
- func InsertAfter(path, anchor, block, label string) error
- func Install(opts Options) error
- func List() []string
- func RegisterModule(def ModuleDefinition)
- type ModuleDefinition
- type Options
- type TemplateData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddMiddlewareLine ¶ added in v0.5.1
AddMiddlewareLine 向中间件链注入一行,供自定义模块使用
func AddRouteLine ¶ added in v0.5.1
AddRouteLine 向路由注册注入一行,供自定义模块使用
func AppendEnvValue ¶ added in v0.5.1
AppendEnvValue 向 .env.example 追加一行配置,供自定义模块使用
func CommonBaseFiles ¶ added in v0.5.1
CommonBaseFiles 返回自定义模块常用的基础文件(日志模块),供 generated module 使用
func DetectModulePath ¶ added in v0.5.1
DetectModulePath 从 go.mod 中检测模块路径,供自定义模块使用
func EnsureImport ¶ added in v0.5.1
EnsureImport 确保导入语句存在,供自定义模块使用
func InsertAfter ¶ added in v0.5.1
InsertAfter 在锚点行之后插入代码块,供自定义模块使用
func RegisterModule ¶ added in v0.5.1
func RegisterModule(def ModuleDefinition)
RegisterModule 注册自定义模块,供 internal/addon/modules/ 下的 init() 调用
Types ¶
type ModuleDefinition ¶ added in v0.5.1
type ModuleDefinition struct {
Name string
Files map[string]string
BaseFiles map[string]string
PatchFunc func(targetDir string) error
}
ModuleDefinition 自定义模块定义,通过 init() 注册到全局注册表
type TemplateData ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.