Documentation
¶
Index ¶
- type Const
- func (c *Const) GetName() string
- func (c *Const) GetType() *Struct
- func (c *Const) SetInnerType(b bool)
- func (c *Const) SetIsStruct(b bool)
- func (c *Const) SetPackagePath(s string)
- func (c *Const) SetPointer(b bool)
- func (c *Const) SetPrivate(b bool)
- func (c *Const) SetSlice(b bool)
- func (c *Const) SetType(namer *Struct)
- func (c *Const) SetTypeString(s string)
- type ConstSection
- type File
- type Import
- type Interface
- type Method
- func (m *Method) Clone() *Method
- func (m *Method) GetMethod() any
- func (m *Method) GetName() string
- func (m *Method) GetType() *Struct
- func (m *Method) IsGenericType(name string) bool
- func (m *Method) SetActualType(name string, as *Struct)
- func (m *Method) SetInnerType(b bool)
- func (m *Method) SetIsStruct(b bool)
- func (m *Method) SetMethod(method any)
- func (m *Method) SetPackagePath(s string)
- func (m *Method) SetParamType(field *ParamField, as *Struct)
- func (m *Method) SetPointer(b bool)
- func (m *Method) SetPrivate(b bool)
- func (m *Method) SetSlice(b bool)
- func (m *Method) SetType(namer *Struct)
- func (m *Method) SetTypeString(s string)
- type ParamField
- func (p *ParamField) Clone() *ParamField
- func (p *ParamField) GetName() string
- func (p *ParamField) GetRType() reflect.Type
- func (p *ParamField) GetType() *Struct
- func (p *ParamField) SetInnerType(b bool)
- func (p *ParamField) SetIsStruct(b bool)
- func (p *ParamField) SetPackagePath(s string)
- func (p *ParamField) SetPointer(b bool)
- func (p *ParamField) SetPrivate(b bool)
- func (p *ParamField) SetRType(t reflect.Type)
- func (p *ParamField) SetSlice(b bool)
- func (p *ParamField) SetType(namer *Struct)
- func (p *ParamField) SetTypeString(s string)
- type Parser
- type Receiver
- type Struct
- func (s *Struct) AppendFields(fields []*StructField)
- func (s *Struct) Clone() *Struct
- func (s *Struct) GetAllFieldsByTag(tag string) []*StructField
- func (s *Struct) GetName() string
- func (s *Struct) GetType() *Struct
- func (s *Struct) HandleCurrentPackageRef(file *File)
- func (s *Struct) HandleCurrentPackageRefs(files map[string]*File)
- func (s *Struct) IsGenericType(name string) bool
- func (s *Struct) SetActualType(name string, as *Struct)
- func (s *Struct) SetInnerType(b bool)
- func (s *Struct) SetIsStruct(b bool)
- func (s *Struct) SetPackagePath(str string)
- func (s *Struct) SetPointer(b bool)
- func (s *Struct) SetPrivate(b bool)
- func (s *Struct) SetSlice(b bool)
- func (s *Struct) SetType(namer *Struct)
- func (s *Struct) SetTypeString(str string)
- type StructField
- func (f *StructField) GetName() string
- func (f *StructField) GetRType() reflect.Type
- func (f *StructField) GetTag(tag string) string
- func (f *StructField) GetType() *Struct
- func (f *StructField) SetInnerType(b bool)
- func (f *StructField) SetIsStruct(b bool)
- func (f *StructField) SetPackagePath(s string)
- func (f *StructField) SetPointer(b bool)
- func (f *StructField) SetPrivate(b bool)
- func (f *StructField) SetRType(t reflect.Type)
- func (f *StructField) SetSlice(b bool)
- func (f *StructField) SetType(namer *Struct)
- func (f *StructField) SetTypeString(s string)
- type TypeParam
- func (t *TypeParam) Clone() *TypeParam
- func (t *TypeParam) GetName() string
- func (t *TypeParam) GetType() *Struct
- func (t *TypeParam) SetInnerType(b bool)
- func (t *TypeParam) SetIsStruct(b bool)
- func (t *TypeParam) SetPackagePath(s string)
- func (t *TypeParam) SetPointer(b bool)
- func (t *TypeParam) SetPrivate(b bool)
- func (t *TypeParam) SetSlice(b bool)
- func (t *TypeParam) SetType(namer *Struct)
- func (t *TypeParam) SetTypeString(s string)
- type Var
- func (v *Var) GetName() string
- func (v *Var) GetType() *Struct
- func (v *Var) SetInnerType(b bool)
- func (v *Var) SetIsStruct(b bool)
- func (v *Var) SetPackagePath(s string)
- func (v *Var) SetPointer(b bool)
- func (v *Var) SetPrivate(b bool)
- func (v *Var) SetSlice(b bool)
- func (v *Var) SetType(namer *Struct)
- func (v *Var) SetTypeString(s string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Const ¶
type Const struct {
Name string // 名称
PackagePath string
TypeString string //类型文本
Type *Struct //类型
Private bool //私有
Slice bool //数组
Value any //值
Docs []string //文档
Comments string //注释
IsIota bool //iota自动判定值(枚举)
}
Const 常量
func (*Const) SetInnerType ¶
func (*Const) SetIsStruct ¶
func (*Const) SetPackagePath ¶
func (*Const) SetPointer ¶
func (*Const) SetPrivate ¶
func (*Const) SetTypeString ¶
type ConstSection ¶
type ConstSection = []*Const
type File ¶
type File struct {
Name string //文件名
PackageName string //包名
Imports []*Import //导入
PackagePath string //包路径
FilePath string //文件路径
Structs []*Struct //结构体
Docs []string //文档
Comments []string //注释
Methods []*Method //结构体方法
Funcs []*Method //函数
Consts []*Const //常量
Vars []*Var //变量
}
File 代表一个已解析的go文件
type Import ¶
type Import struct {
Name string //名称
Alias string //别名
ImportPath string //导入路径
IsIgnore bool //是否 _ 隐式导入
}
Import 导入
type Method ¶
type Method struct {
Receiver *Receiver
Index int
PackagePath string
Name string
Private bool
Signature string
Docs []string
Comments string
Params []*ParamField
Results []*ParamField
IsGeneric bool
TypeParams []*TypeParam
// contains filtered or unexported fields
}
Method 结构体方法
func (*Method) IsGenericType ¶
func (*Method) SetActualType ¶
func (*Method) SetInnerType ¶
func (*Method) SetIsStruct ¶
func (*Method) SetPackagePath ¶
func (*Method) SetParamType ¶
func (m *Method) SetParamType(field *ParamField, as *Struct)
func (*Method) SetPointer ¶
func (*Method) SetPrivate ¶
func (*Method) SetTypeString ¶
type ParamField ¶
type ParamField struct {
Index int //索引
Name string //字段名
PackagePath string //包名
Type *Struct //类型
HasTag bool //是否有tag
Tag reflect.StructTag `json:"-"` //tag
TypeString string //类型文本
InnerType bool //内置类型
Private bool //私有
Pointer bool //指针字段
Slice bool //数组字段
IsStruct bool //是否结构体
Docs []string //文档
Comment string //注释
IsGeneric bool
// contains filtered or unexported fields
}
ParamField 结构体字段
func (*ParamField) Clone ¶
func (p *ParamField) Clone() *ParamField
func (*ParamField) GetName ¶
func (p *ParamField) GetName() string
func (*ParamField) GetRType ¶
func (p *ParamField) GetRType() reflect.Type
func (*ParamField) GetType ¶
func (p *ParamField) GetType() *Struct
func (*ParamField) SetInnerType ¶
func (p *ParamField) SetInnerType(b bool)
func (*ParamField) SetIsStruct ¶
func (p *ParamField) SetIsStruct(b bool)
func (*ParamField) SetPackagePath ¶
func (p *ParamField) SetPackagePath(s string)
func (*ParamField) SetPointer ¶
func (p *ParamField) SetPointer(b bool)
func (*ParamField) SetPrivate ¶
func (p *ParamField) SetPrivate(b bool)
func (*ParamField) SetRType ¶
func (p *ParamField) SetRType(t reflect.Type)
func (*ParamField) SetSlice ¶
func (p *ParamField) SetSlice(b bool)
func (*ParamField) SetType ¶
func (p *ParamField) SetType(namer *Struct)
func (*ParamField) SetTypeString ¶
func (p *ParamField) SetTypeString(s string)
type Parser ¶
func (*Parser) VisitAllStructs ¶
type Receiver ¶
type Receiver struct {
Name string //参数名
Pointer bool //是否指针
TypeString string //类型名
Type *Struct //类型
}
Receiver 接收器
type Struct ¶
type Struct struct {
Name string //结构体名
PackagePath string //所属包名
KeyHash string //所在文件hash值, 重复解析时直接获取
Fields []*StructField //结构体字段
Methods []*Method //结构体方法
HasParent bool //是否有继承结构
IsInterface bool
Inter *Interface
Docs []string //文档
Comment string //注释
IsGeneric bool
TypeParams []*TypeParam
}
Struct 结构体
func (*Struct) AppendFields ¶
func (s *Struct) AppendFields(fields []*StructField)
func (*Struct) GetAllFieldsByTag ¶
func (s *Struct) GetAllFieldsByTag(tag string) []*StructField
func (*Struct) HandleCurrentPackageRef ¶
func (*Struct) HandleCurrentPackageRefs ¶
func (*Struct) IsGenericType ¶
func (*Struct) SetActualType ¶
func (*Struct) SetInnerType ¶
func (*Struct) SetIsStruct ¶
func (*Struct) SetPackagePath ¶
func (*Struct) SetPointer ¶
func (*Struct) SetPrivate ¶
func (*Struct) SetTypeString ¶
type StructField ¶
type StructField struct {
Index int //索引
Name string //字段名
IsParent bool
PackagePath string //包名
Type *Struct //类型
HasTag bool //是否有tag
Tag reflect.StructTag `json:"-"` //tag
TypeString string //类型文本
InnerType bool //内置类型
Private bool //私有
Pointer bool //指针字段
Slice bool //数组字段
IsStruct bool //是否结构体
Docs []string //文档
Comment string //注释
IsGeneric bool
// contains filtered or unexported fields
}
StructField 结构体字段
func (*StructField) GetName ¶
func (f *StructField) GetName() string
func (*StructField) GetRType ¶
func (f *StructField) GetRType() reflect.Type
func (*StructField) GetTag ¶
func (f *StructField) GetTag(tag string) string
func (*StructField) GetType ¶
func (f *StructField) GetType() *Struct
func (*StructField) SetInnerType ¶
func (f *StructField) SetInnerType(b bool)
func (*StructField) SetIsStruct ¶
func (f *StructField) SetIsStruct(b bool)
func (*StructField) SetPackagePath ¶
func (f *StructField) SetPackagePath(s string)
func (*StructField) SetPointer ¶
func (f *StructField) SetPointer(b bool)
func (*StructField) SetPrivate ¶
func (f *StructField) SetPrivate(b bool)
func (*StructField) SetRType ¶
func (f *StructField) SetRType(t reflect.Type)
func (*StructField) SetSlice ¶
func (f *StructField) SetSlice(b bool)
func (*StructField) SetType ¶
func (f *StructField) SetType(namer *Struct)
func (*StructField) SetTypeString ¶
func (f *StructField) SetTypeString(s string)
type TypeParam ¶
type TypeParam struct {
Name string //泛型名
PackagePath string
TypeName string //泛型约束名
Type *Struct //泛型约束
ActualType *Struct //实际类型
}
func (*TypeParam) SetInnerType ¶
func (*TypeParam) SetIsStruct ¶
func (*TypeParam) SetPackagePath ¶
func (*TypeParam) SetPointer ¶
func (*TypeParam) SetPrivate ¶
func (*TypeParam) SetTypeString ¶
type Var ¶
type Var struct {
Name string //变量名
PackagePath string
TypeString string //类型文本
Type *Struct //类型
InnerType bool //内置类型
IsStruct bool //是否结构体
Pointer bool //指针
Private bool //私有
Slice bool //数组
Value any //值
Docs []string //文档
Comments string //注释
}
Var 变量
func (*Var) SetInnerType ¶
func (*Var) SetIsStruct ¶
func (*Var) SetPackagePath ¶
func (*Var) SetPointer ¶
func (*Var) SetPrivate ¶
func (*Var) SetTypeString ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.