Documentation ¶
Index ¶
- Constants
- func AstDirFuncDecl(path string, ...)
- func AstDirTypeDecl(path string, ...)
- func AstFileGenDecl(filePath string, fund func(genDecl *ast.GenDecl))
- func BuildRoute(routePath string, routeComments []RouteComment)
- func CheckIsRoute(routePath string) (isRoute bool)
- func ExistsGoMod(rootPath string) bool
- func GetModRequire(rootPath string) collections.List[string]
- func GetRootPackage(rootPath string) string
- func GetRootPackage2(rootPath string) string
- type Annotation
- type RouteComment
- func (receiver *RouteComment) IsHaveComment(route map[string]string) bool
- func (receiver *RouteComment) ParseFuncComment(ant *Annotation, route map[string]string)
- func (receiver *RouteComment) ParseFuncType(astFile *ast.File, funcDecl *ast.FuncDecl)
- func (receiver *RouteComment) ParsePackageComment(ant *Annotation)
Constants ¶
View Source
const CommentPrefix = "//"
Variables ¶
This section is empty.
Functions ¶
func AstDirFuncDecl ¶
func AstDirTypeDecl ¶
func AstFileGenDecl ¶
func BuildRoute ¶
func BuildRoute(routePath string, routeComments []RouteComment)
BuildRoute 生成route.go文件
func GetModRequire ¶
func GetModRequire(rootPath string) collections.List[string]
GetModRequire 得到依赖包
func GetRootPackage2 ¶ added in v0.14.2
GetRootPackage2 得到包名
Types ¶
type Annotation ¶
func GetAnnotation ¶
func GetAnnotation(comment string) *Annotation
func (*Annotation) IsApi ¶
func (receiver *Annotation) IsApi() bool
func (*Annotation) IsArea ¶
func (receiver *Annotation) IsArea() bool
func (*Annotation) IsCodeReview ¶ added in v0.13.2
func (receiver *Annotation) IsCodeReview() bool
func (*Annotation) IsDi ¶
func (receiver *Annotation) IsDi() bool
func (*Annotation) IsFilter ¶
func (receiver *Annotation) IsFilter() bool
func (*Annotation) IsMessage ¶
func (receiver *Annotation) IsMessage() bool
type RouteComment ¶
type RouteComment struct { Area string // 区域 @area Url string // 路由地址 @get {area}/order/{action} Method string // 路由method @get {area}/order/{action} IocNames map[string]string // 注入别名 @di repository default StatusMessage string // api返回message @message 成功 PackagePath string // 包路径 PackageName string // 包名 FuncName string // handle名称 ProjectPath string // 项目根目录 TopPackageName string // 顶级包名 CodeReview bool // 是否做了CodeReview // contains filtered or unexported fields }
RouteComment 路由注解、函数类型
func (*RouteComment) IsHaveComment ¶
func (receiver *RouteComment) IsHaveComment(route map[string]string) bool
IsHaveComment 是否有解析到
func (*RouteComment) ParseFuncComment ¶
func (receiver *RouteComment) ParseFuncComment(ant *Annotation, route map[string]string)
ParseFuncComment 解析函数注解
func (*RouteComment) ParseFuncType ¶
func (receiver *RouteComment) ParseFuncType(astFile *ast.File, funcDecl *ast.FuncDecl)
ParseFuncType 解析函数名称、参数类型
func (*RouteComment) ParsePackageComment ¶
func (receiver *RouteComment) ParsePackageComment(ant *Annotation)
ParsePackageComment 解析包注解
Click to show internal directories.
Click to hide internal directories.