Documentation ¶
Index ¶
- func GetImportPathListFromFile(filepath string) (importPathList []string, err error)
- func MustGetGoTypeFromPkgPathAndTypeName(pkgPath string, typ string) types.Type
- func MustGetGoTypesFromReflect(typ reflect.Type) types.Type
- func MustGetMethodListFromGoTypes(typ types.Type) (output []*types.Selection)
- func MustNewGoTypesMainPackageFromImportPath(importPath string) *types.Package
- func MustNewMainAstPackageFromImportPath(importPath string) (pkg *ast.Package, fset *token.FileSet)
- func MustWriteGoTypes(thisPackagePath string, typi types.Type) (s string, addPkgPathList []string)
- func UnquoteGolangDoubleQuote(in string) (out string, err error)
- type Func
- type FuncArgument
- type Kind
- type Method
- type Package
- type Type
- type TypePointer
- type TypeStruct
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustGetGoTypeFromPkgPathAndTypeName ¶
类型名称定义 github.com/bronze1man/kmg/kmgGoSource/testPackage.Demo
func MustNewGoTypesMainPackageFromImportPath ¶
返回这个导入路径的主Package的types.Package对象 TODO 解决测试package的问题
func MustWriteGoTypes ¶
func UnquoteGolangDoubleQuote ¶
反序列化 golang的双引号 "encoding/json" -> encoding/json
Types ¶
type Func ¶
type Func struct { Name string InArgList []FuncArgument OutArgList []FuncArgument }
type FuncArgument ¶
type Package ¶
type Package struct {
// contains filtered or unexported fields
}
表示一个golang里面的package
func MustNewPackageFromImportPath ¶
使用importPath获取一个Package, 仅支持导入一个目录作为一个package 只导入一个package里面的主package,xxx_test不导入. 注意: 需要源代码,需要使用kmg配置GOPATH
type Type ¶
type Type interface { Kind() Kind Method() []Method //在这个pkgPath里面的表示方法 WriteInPkgPath(currentPkgPath string) (str string, importPathList []string) }
表示一种golang的类型
func MustNewTypeFromReflectType ¶
从反射的类型获取一个Type 主要: 需要运行时有源代码,需要使用kmg配置GOPATH
type TypePointer ¶
type TypePointer struct {
Elem Type
}
表示一个指针类型
func (TypePointer) Kind ¶
func (p TypePointer) Kind() Kind
func (TypePointer) Method ¶
func (p TypePointer) Method() []Method
func (TypePointer) WriteInPkgPath ¶
func (p TypePointer) WriteInPkgPath(currentPkgPath string) (str string, importPathList []string)
type TypeStruct ¶
type TypeStruct struct {
// contains filtered or unexported fields
}
表示一个struct类型
func (TypeStruct) Kind ¶
func (p TypeStruct) Kind() Kind
func (TypeStruct) Method ¶
func (p TypeStruct) Method() []Method
func (TypeStruct) Package ¶
func (p TypeStruct) Package() *Package
func (TypeStruct) WriteInPkgPath ¶
func (p TypeStruct) WriteInPkgPath(currentPkgPath string) (str string, importPathList []string)
Click to show internal directories.
Click to hide internal directories.