Documentation ¶
Index ¶
- Constants
- func AddImport(astNode ast.Node, imp string)
- func AddRegisterTablesAst(path, funcName, pk, varName, dbName, model string)
- func AddRouterCode(path, funcName, pk, model string)
- func AppendNodeToList(stmts []ast.Stmt, stmt ast.Stmt, index int) []ast.Stmt
- func CheckImport(file *ast.File, importPath string) bool
- func CreateApiStructAst(apis []system.SysApi) *[]ast.Expr
- func CreateMenuStructAst(menus []system.SysBaseMenu) *[]ast.Expr
- func CreateStmt(statement string) *ast.ExprStmt
- func FindArray(astNode ast.Node, identName, selectorExprName string) *ast.CompositeLit
- func FindFunction(astNode ast.Node, FunctionName string) *ast.FuncDecl
- func ImportForAutoEnter(path string, funcName string, code string)
- func ImportReference(filepath, importCode, structName, packageName, groupName string) error
- func IsBlockStmt(node ast.Node) bool
- func NeedAppendModel(callNode ast.Node, pk string, model string) bool
- func RollBackAst(pk, model string)
- func RollGormBack(pk, model string)
- func RollRouterBack(pk, model string)
- func VariableExistsInBlock(block *ast.BlockStmt, varName string) bool
- type Ast
- type Base
- func (a *Base) AbsolutePath(filePath string) string
- func (a *Base) Format(filename string, writer io.Writer, file *ast.File) error
- func (a *Base) Injection(file *ast.File) error
- func (a *Base) Parse(filename string, writer io.Writer) (file *ast.File, err error)
- func (a *Base) RelativePath(filePath string) string
- func (a *Base) Rollback(file *ast.File) error
- type Import
- type PackageEnter
- type PackageInitializeGorm
- func (a *PackageInitializeGorm) Format(filename string, writer io.Writer, file *ast.File) error
- func (a *PackageInitializeGorm) Injection(file *ast.File) error
- func (a *PackageInitializeGorm) Parse(filename string, writer io.Writer) (file *ast.File, err error)
- func (a *PackageInitializeGorm) Rollback(file *ast.File) error
- type PackageInitializeRouter
- func (a *PackageInitializeRouter) CreateAssignStmt() *ast.AssignStmt
- func (a *PackageInitializeRouter) Format(filename string, writer io.Writer, file *ast.File) error
- func (a *PackageInitializeRouter) Injection(file *ast.File) error
- func (a *PackageInitializeRouter) Parse(filename string, writer io.Writer) (file *ast.File, err error)
- func (a *PackageInitializeRouter) Rollback(file *ast.File) error
- type PackageModuleEnter
- func (a *PackageModuleEnter) Format(filename string, writer io.Writer, file *ast.File) error
- func (a *PackageModuleEnter) Injection(file *ast.File) error
- func (a *PackageModuleEnter) Parse(filename string, writer io.Writer) (file *ast.File, err error)
- func (a *PackageModuleEnter) Rollback(file *ast.File) error
- type PluginEnter
- type PluginGen
- type PluginInitializeGorm
- func (a *PluginInitializeGorm) Format(filename string, writer io.Writer, file *ast.File) error
- func (a *PluginInitializeGorm) Injection(file *ast.File) error
- func (a *PluginInitializeGorm) Parse(filename string, writer io.Writer) (file *ast.File, err error)
- func (a *PluginInitializeGorm) Rollback(file *ast.File) error
- type PluginInitializeRouter
- func (a *PluginInitializeRouter) Format(filename string, writer io.Writer, file *ast.File) error
- func (a *PluginInitializeRouter) Injection(file *ast.File) error
- func (a *PluginInitializeRouter) Parse(filename string, writer io.Writer) (file *ast.File, err error)
- func (a *PluginInitializeRouter) Rollback(file *ast.File) error
- type PluginInitializeV2
- func (a *PluginInitializeV2) Format(filename string, writer io.Writer, file *ast.File) error
- func (a *PluginInitializeV2) Injection(file *ast.File) error
- func (a *PluginInitializeV2) Parse(filename string, writer io.Writer) (file *ast.File, err error)
- func (a *PluginInitializeV2) Rollback(file *ast.File) error
- type Type
- type Visitor
Constants ¶
View Source
const ( TypePackageApiEnter = "PackageApiEnter" // server/api/v1/enter.go TypePackageRouterEnter = "PackageRouterEnter" // server/router/enter.go TypePackageServiceEnter = "PackageServiceEnter" // server/service/enter.go TypePackageApiModuleEnter = "PackageApiModuleEnter" // server/api/v1/{package}/enter.go TypePackageRouterModuleEnter = "PackageRouterModuleEnter" // server/router/{package}/enter.go TypePackageServiceModuleEnter = "PackageServiceModuleEnter" // server/service/{package}/enter.go TypePackageInitializeGorm = "PackageInitializeGorm" // server/initialize/gorm_biz.go TypePackageInitializeRouter = "PackageInitializeRouter" // server/initialize/router_biz.go TypePluginGen = "PluginGen" // server/plugin/{package}/gen/main.go TypePluginApiEnter = "PluginApiEnter" // server/plugin/{package}/enter.go TypePluginInitializeV1 = "PluginInitializeV1" // server/initialize/plugin_biz_v1.go TypePluginInitializeV2 = "PluginInitializeV2" // server/initialize/plugin_biz_v2.go TypePluginRouterEnter = "PluginRouterEnter" // server/plugin/{package}/enter.go TypePluginServiceEnter = "PluginServiceEnter" // server/plugin/{package}/enter.go TypePluginInitializeApi = "PluginInitializeApi" // server/plugin/{package}/initialize/api.go TypePluginInitializeGorm = "PluginInitializeGorm" // server/plugin/{package}/initialize/gorm.go TypePluginInitializeMenu = "PluginInitializeMenu" // server/plugin/{package}/initialize/menu.go TypePluginInitializeRouter = "PluginInitializeRouter" // server/plugin/{package}/initialize/router.go )
Variables ¶
This section is empty.
Functions ¶
func AddRegisterTablesAst ¶
func AddRegisterTablesAst(path, funcName, pk, varName, dbName, model string)
自动为 gorm.go 注册一个自动迁移
func AddRouterCode ¶
func AddRouterCode(path, funcName, pk, model string)
func AppendNodeToList ¶
func CreateMenuStructAst ¶
func CreateMenuStructAst(menus []system.SysBaseMenu) *[]ast.Expr
func CreateStmt ¶
func FindArray ¶
func FindArray(astNode ast.Node, identName, selectorExprName string) *ast.CompositeLit
FindArray 查询特定数组方法
func FindFunction ¶
FindFunction 查询特定function方法
func ImportForAutoEnter ¶
func ImportReference ¶
func IsBlockStmt ¶
func NeedAppendModel ¶
为automigrate增加实参
func RollBackAst ¶
func RollBackAst(pk, model string)
func RollGormBack ¶
func RollGormBack(pk, model string)
func RollRouterBack ¶
func RollRouterBack(pk, model string)
Types ¶
type Base ¶
type Base struct{}
func (*Base) AbsolutePath ¶
AbsolutePath 相对路径转绝对路径
func (*Base) RelativePath ¶
RelativePath 绝对路径转相对路径
type PackageEnter ¶
type PackageEnter struct { Base Type Type // 类型 Path string // 文件路径 ImportPath string // 导包路径 StructName string // 结构体名称 PackageName string // 包名 RelativePath string // 相对路径 PackageStructName string // 包结构体名称 }
PackageEnter 模块化入口
type PackageInitializeGorm ¶
type PackageInitializeGorm struct { Base Type Type // 类型 Path string // 文件路径 ImportPath string // 导包路径 Business string // 业务库 gva => gva, 不要传"gva" StructName string // 结构体名称 PackageName string // 包名 RelativePath string // 相对路径 IsNew bool // 是否使用new关键字 true: new(PackageName.StructName) false: &PackageName.StructName{} }
PackageInitializeGorm 包初始化gorm
func (*PackageInitializeGorm) Injection ¶
func (a *PackageInitializeGorm) Injection(file *ast.File) error
type PackageInitializeRouter ¶
type PackageInitializeRouter struct { Base Type Type // 类型 Path string // 文件路径 ImportPath string // 导包路径 RelativePath string // 相对路径 AppName string // 应用名称 GroupName string // 分组名称 ModuleName string // 模块名称 PackageName string // 包名 FunctionName string // 函数名 RouterGroupName string // 路由分组名称 LeftRouterGroupName string // 左路由分组名称 RightRouterGroupName string // 右路由分组名称 }
PackageInitializeRouter 包初始化路由 ModuleName := PackageName.AppName.GroupName ModuleName.FunctionName(RouterGroupName)
func (*PackageInitializeRouter) CreateAssignStmt ¶
func (a *PackageInitializeRouter) CreateAssignStmt() *ast.AssignStmt
func (*PackageInitializeRouter) Injection ¶
func (a *PackageInitializeRouter) Injection(file *ast.File) error
type PackageModuleEnter ¶
type PackageModuleEnter struct { Base Type Type // 类型 Path string // 文件路径 ImportPath string // 导包路径 RelativePath string // 相对路径 StructName string // 结构体名称 AppName string // 应用名称 GroupName string // 分组名称 ModuleName string // 模块名称 PackageName string // 包名 ServiceName string // 服务名称 }
PackageModuleEnter 模块化入口 ModuleName := PackageName.AppName.GroupName.ServiceName
type PluginEnter ¶
type PluginEnter struct { Base Type Type // 类型 Path string // 文件路径 ImportPath string // 导包路径 RelativePath string // 相对路径 StructName string // 结构体名称 StructCamelName string // 结构体小驼峰名称 ModuleName string // 模块名称 GroupName string // 分组名称 PackageName string // 包名 ServiceName string // 服务名称 }
PluginEnter 插件化入口 ModuleName := PackageName.GroupName.ServiceName
type PluginGen ¶
type PluginGen struct { Base Type Type // 类型 Path string // 文件路径 ImportPath string // 导包路径 RelativePath string // 相对路径 StructName string // 结构体名称 PackageName string // 包名 IsNew bool // 是否使用new关键字 }
type PluginInitializeGorm ¶
type PluginInitializeGorm struct { Base Type Type // 类型 Path string // 文件路径 ImportPath string // 导包路径 RelativePath string // 相对路径 StructName string // 结构体名称 PackageName string // 包名 IsNew bool // 是否使用new关键字 true: new(PackageName.StructName) false: &PackageName.StructName{} }
func (*PluginInitializeGorm) Injection ¶
func (a *PluginInitializeGorm) Injection(file *ast.File) error
type PluginInitializeRouter ¶
type PluginInitializeRouter struct { Base Type Type // 类型 Path string // 文件路径 ImportPath string // 导包路径 ImportGlobalPath string // 导包全局变量路径 ImportMiddlewarePath string // 导包中间件路径 RelativePath string // 相对路径 AppName string // 应用名称 GroupName string // 分组名称 PackageName string // 包名 FunctionName string // 函数名 LeftRouterGroupName string // 左路由分组名称 RightRouterGroupName string // 右路由分组名称 }
PluginInitializeRouter 插件初始化路由 PackageName.AppName.GroupName.FunctionName()
func (*PluginInitializeRouter) Injection ¶
func (a *PluginInitializeRouter) Injection(file *ast.File) error
type PluginInitializeV2 ¶
type PluginInitializeV2 struct { Base Type Type // 类型 Path string // 文件路径 PluginPath string // 插件路径 RelativePath string // 相对路径 ImportPath string // 导包路径 StructName string // 结构体名称 PackageName string // 包名 }
Source Files ¶
- ast.go
- ast_auto_enter.go
- ast_enter.go
- ast_gorm.go
- ast_rollback.go
- ast_router.go
- ast_type.go
- import.go
- interfaces.go
- interfaces_base.go
- package_enter.go
- package_initialize_gorm.go
- package_initialize_router.go
- package_module_enter.go
- plugin_enter.go
- plugin_gen.go
- plugin_initialize_gorm.go
- plugin_initialize_router.go
- plugin_initialize_v2.go
Click to show internal directories.
Click to hide internal directories.