addon

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMiddlewareLine added in v0.5.1

func AddMiddlewareLine(targetDir, line string) error

AddMiddlewareLine 向中间件链注入一行,供自定义模块使用

func AddRouteLine added in v0.5.1

func AddRouteLine(targetDir, routeLine, routeLabel string) error

AddRouteLine 向路由注册注入一行,供自定义模块使用

func AppendEnvValue added in v0.5.1

func AppendEnvValue(targetDir, line string) error

AppendEnvValue 向 .env.example 追加一行配置,供自定义模块使用

func CommonBaseFiles added in v0.5.1

func CommonBaseFiles() map[string]string

CommonBaseFiles 返回自定义模块常用的基础文件(日志模块),供 generated module 使用

func DetectModulePath added in v0.5.1

func DetectModulePath(targetDir string) (string, error)

DetectModulePath 从 go.mod 中检测模块路径,供自定义模块使用

func EnsureImport added in v0.5.1

func EnsureImport(path, anchor, importLine string) error

EnsureImport 确保导入语句存在,供自定义模块使用

func InsertAfter added in v0.5.1

func InsertAfter(path, anchor, block, label string) error

InsertAfter 在锚点行之后插入代码块,供自定义模块使用

func Install

func Install(opts Options) error

func List

func List() []string

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 Options

type Options struct {
	ModuleName   string
	TargetDir    string
	Force        bool
	SkipExisting bool
}

type TemplateData

type TemplateData struct {
	ModulePath  string
	ProjectName string
}

Directories

Path Synopsis
Package modules 存放通过 Golider create-module 生成的自定义模块。
Package modules 存放通过 Golider create-module 生成的自定义模块。

Jump to

Keyboard shortcuts

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