Documentation ¶
Index ¶
- func Format(fileName, content string, formatOnly bool) (string, error)
- func LcFirst(str string) string
- func ReplaceNameof(pkg string)
- func UcFirst(str string) string
- type DeclResult
- type ExprResult
- type Field
- type FieldResult
- type FileResult
- type Func
- type IIIIIIIInfo
- type ImportPath
- func (p *ImportPath) FindAllModule(dir string) (mods []Module, err error)
- func (p *ImportPath) GetByCurrentDir() (path string, err error)
- func (p *ImportPath) GetCurrentDirModFilePath() (modDir, modPath string, err error)
- func (p *ImportPath) GetModFilePath(dir string) (modDir, modPath string, err error)
- func (p *ImportPath) SplitImportPathWithType(importPathWithType string) (string, string)
- type ImportPathAlias
- type InspectOption
- type Inspector
- type Interface
- type Method
- type Module
- type Op
- type Option
- type Package
- type Packages
- type Parser
- type PkgInfo
- type SpecResult
- type StmtResult
- type Struct
- type TokenResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReplaceNameof ¶ added in v0.35.0
func ReplaceNameof(pkg string)
Types ¶
type DeclResult ¶
type DeclResult struct {
// contains filtered or unexported fields
}
func MakeDeclResult ¶
func MakeDeclResult() DeclResult
type ExprResult ¶
type ExprResult struct { Fields []Field // contains filtered or unexported fields }
func MakeExprResult ¶
func MakeExprResult() ExprResult
func (ExprResult) Merge ¶
func (er ExprResult) Merge(oer ExprResult) (ner ExprResult)
type Field ¶
type Field struct { Id string // 唯一标志 Name string // 名称 Anonymous bool // 是否匿名 TypesType types.Type // 原始类型 Type string // 类型,包含包导入路径 Tag string `json:"tag"` // 结构体字段的tag TagBasicLit *ast.BasicLit // ast的tag类型 Doc string // 文档 Comment string // 注释 }
Field 字段
type FieldResult ¶
func MakeFieldResult ¶
func MakeFieldResult() FieldResult
type FileResult ¶
type FileResult struct {
// contains filtered or unexported fields
}
func MakeFileResult ¶
func MakeFileResult() FileResult
type Func ¶
type Func struct { Origin *types.Func PkgPath string // 包路径 Recv string // 方法的receiver Name string Signature string Calls []Func // 调用的函数/方法 }
func (Func) PrintCallGraph ¶
PrintCallGraph 打印调用图,用ignore忽略包,用depth指定深度
type ImportPath ¶
type ImportPath struct { }
func (*ImportPath) FindAllModule ¶
func (p *ImportPath) FindAllModule(dir string) (mods []Module, err error)
FindAllModule find all module in dir
func (*ImportPath) GetByCurrentDir ¶
func (p *ImportPath) GetByCurrentDir() (path string, err error)
GetCurrentDirPath get import path in current directory
func (*ImportPath) GetCurrentDirModFilePath ¶
func (p *ImportPath) GetCurrentDirModFilePath() (modDir, modPath string, err error)
func (*ImportPath) GetModFilePath ¶
func (p *ImportPath) GetModFilePath(dir string) (modDir, modPath string, err error)
func (*ImportPath) SplitImportPathWithType ¶
func (p *ImportPath) SplitImportPathWithType(importPathWithType string) (string, string)
type ImportPathAlias ¶
type ImportPathAlias = ImportPath
type InspectOption ¶
type InspectOption struct {
Parser *Parser
}
type Inspector ¶
type Inspector struct {
// contains filtered or unexported fields
}
func NewInspector ¶
func NewInspector(opt InspectOption) *Inspector
func (*Inspector) InspectFile ¶
func (ins *Inspector) InspectFile(file *ast.File) (result FileResult)
type Interface ¶
type Op ¶
type Op string
const ( OpReplace Op = "replace" OpMock Op = "mock" OpImpl Op = "impl" OpInterface Op = "interface" OpCallgraph Op = "callgraph" OpGenProject Op = "genproject" OpGenProxy Op = "genproxy" OpFind Op = "find" OpGenStructFromSQL Op = "sql2struct" OpGenDataForTable Op = "gendata" OpGenStructFromJSON Op = "json2struct" )
type Parser ¶
type Parser struct { PkgInfo // contains filtered or unexported fields }
Parser 解析器 解析指定的包导入路径,获取go源码信息
func (*Parser) GetPkgInfo ¶
func (*Parser) GetStandardPackages ¶
type PkgInfo ¶
type PkgInfo struct {
// contains filtered or unexported fields
}
func (PkgInfo) GetPkgName ¶
type SpecResult ¶
type SpecResult struct {
// contains filtered or unexported fields
}
func MakeSpecResult ¶
func MakeSpecResult() SpecResult
type StmtResult ¶
type StmtResult struct {
// contains filtered or unexported fields
}
func MakeStmtResult ¶
func MakeStmtResult() StmtResult
func (StmtResult) Merge ¶
func (er StmtResult) Merge(oer StmtResult) (ner StmtResult)
func (StmtResult) MergeExprResult ¶
func (er StmtResult) MergeExprResult(oer ExprResult) (ner StmtResult)
type Struct ¶
type Struct struct { // 如:github.com/pkg/errors PkgPath string `json:"pkgPath" toml:"pkg_path"` // 包路径 // 如: errors PkgName string // 包名 Field Fields []Field // 字段列表 Methods []Method // 方法列表 }
Struct 结构体
func (Struct) TypeAlias ¶
func (s Struct) TypeAlias(p IIIIIIIInfo, ip ImportPathAlias)
type TokenResult ¶
type TokenResult struct { }
Click to show internal directories.
Click to hide internal directories.