Documentation ¶
Index ¶
- func NewParseAll() *parseAll
- func SaveGoMeta(key string, meta *GoMeta)
- type Def
- type Enum
- type GoMeta
- type GoParse
- func (g *GoParse) FormatPath(path string) (fp string, isInProject bool)
- func (g *GoParse) GetDef(pkgDir string, key string) (def *Def, exist bool, err error)
- func (g *GoParse) GetEnum(pkgDir string, typ string) (enum *Enum, err error)
- func (g *GoParse) GetFileImportedPkgs(filePath string) (pkgs Pkgs, err error)
- func (g *GoParse) GetFuncOfStruct(pkgDir string, typName string) (enum map[string]*Def, err error)
- func (g *GoParse) GetPkgOfFile(filePath string) (pkg string)
- type Let
- type Pkg
- type Pkgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewParseAll ¶
func NewParseAll() *parseAll
func SaveGoMeta ¶
Types ¶
type Def ¶
type Def struct { // Name 是 `type Tag struct{}` 中的 Tag Name string // Key 是 唯一标识. e.g. github.com/gopenapi/gopenapi/internal/model.Tag Key string Type ast.Expr `json:"-"` // 只有方法定义有这个值 FuncRecv *ast.FieldList `json:"-"` // 定义在哪个文件(相对路径), e.g. github.com/gopenapi/gopenapi/internal/model/pet.go File string Doc *ast.CommentGroup }
所有的定义
方法 类型
type Enum ¶
type Enum struct { Type string `json:"type"` Values []interface{} `json:"values"` Keys []string `json:"keys"` }
func (*Enum) FirstValue ¶
FirstValue 返回第一个枚举值, 一般用作default值.
type GoParse ¶
type GoParse struct {
// contains filtered or unexported fields
}
GoParse Parse the go src to: - doc - struct
func NewGoParse ¶
func (*GoParse) FormatPath ¶
func (*GoParse) GetDef ¶
GetDef 获取结构体/方法定义 pkgDir: 基于gomod的引入路径 key:
PetHandler or: PetHandler.FuncA 不支持查询结构体成员属性.
func (*GoParse) GetFileImportedPkgs ¶
GetFileImportedPkgs 获取文件中所有导入的包. Tips: 目前只支持获取文件中导入的**本项目**的其他包. goFilePath: github.com/gopenapi/gopenapi/internal/delivery/http/handler/pet.go
func (*GoParse) GetFuncOfStruct ¶
GetFuncOfStruct 获取结构体上的func
func (*GoParse) GetPkgOfFile ¶
GetPkgOfFile 获取文件所在的pkg github.com/gopenapi/gopenapi/internal/delivery/http/handler/pet.go 返回 github.com/gopenapi/gopenapi/internal/delivery/http/handler
Click to show internal directories.
Click to hide internal directories.