Documentation
¶
Index ¶
- func CopySlice[T IElem[T]](src []T) []T
- func CopySliceWithFilter[T IElem[T]](src []T, filter func(T) bool) []T
- func SetDeepClone(deep bool)
- type Comment
- type Const
- type Context
- type Enum
- type EnumItem
- type Field
- type File
- type Function
- func (f *Function) Clone() *Function
- func (f *Function) GetAttrValue(attr constants.AttrType) string
- func (f *Function) GetAttrs() []*Comment
- func (f *Function) GetCustomAttrs() []*Comment
- func (f *Function) GetHttpMethodAttrs() []*Comment
- func (f *Function) GetRValue() reflect.Value
- func (f *Function) GetValue() any
- func (f *Function) HasAttr(attr constants.AttrType) bool
- func (f *Function) HasAttrs() bool
- func (f *Function) IsOp() bool
- func (f *Function) SetRValue(t reflect.Value)
- func (f *Function) SetValue(t any)
- func (f *Function) String() string
- func (f *Function) VisitParams(handler func(param *Param))
- func (f *Function) VisitResults(handler func(param *Param))
- type IElem
- type Import
- type Interface
- type Package
- type Param
- type PkgType
- type Project
- type Receiver
- type Struct
- func (s *Struct) Clone() *Struct
- func (s *Struct) CloneFull() *Struct
- func (s *Struct) GetAttr() constants.AttrType
- func (s *Struct) GetAttrValue(attr constants.AttrType) string
- func (s *Struct) GetAttrs() []*Comment
- func (s *Struct) GetCustomAttrs() []*Comment
- func (s *Struct) GetRType() reflect.Type
- func (s *Struct) GetRValue() reflect.Value
- func (s *Struct) GetValue() any
- func (s *Struct) HasAttr(attr constants.AttrType) bool
- func (s *Struct) HasCustomAttr(attr string) bool
- func (s *Struct) HasParamAttr() bool
- func (s *Struct) IsEnum() bool
- func (s *Struct) IsTop() bool
- func (s *Struct) SetRType(t reflect.Type)
- func (s *Struct) SetRValue(r reflect.Value)
- func (s *Struct) SetValue(v any)
- func (s *Struct) String() string
- func (s *Struct) VisitFields(filter func(f *Field) bool, handler func(f *Field))
- func (s *Struct) VisitMethods(filter func(f *Function) bool, handler func(f *Function))
- type TypeParam
- type Variable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopySliceWithFilter ¶
func SetDeepClone ¶
func SetDeepClone(deep bool)
Types ¶
type Comment ¶
type Comment struct {
Index int `json:"index"`
Content string `json:"content"` //原始的一行注释内容
IsSelf bool `json:"is_self,omitempty"` // 注释是否是以自己名称开头
Op bool `json:"op,omitempty"`
AttrType constants.AttrType `json:"attr_type"`
CustomAttr string `json:"custom_attr,omitempty"`
AttrValue string `json:"attr_value,omitempty"`
}
func (*Comment) GetWithoutSelf ¶
func (*Comment) IsHttpMethod ¶
type Enum ¶
type Enum struct {
Index int `json:"index"`
Type string `json:"type"`
TypeName string `json:"type_name"`
ElemType constants.ElemType `json:"elem_type"`
Name string `json:"name"`
Doc []*Comment `json:"doc,omitempty"`
Comment []*Comment `json:"comment,omitempty"`
Private bool `json:"private,omitempty"`
Iota bool `json:"iota"`
Enums []*EnumItem `json:"enums,omitempty"`
}
type EnumItem ¶
type Field ¶
type Field struct {
Index int `json:"index"`
Name string `json:"name"`
TypeName string `json:"type_name"`
Type string `json:"type"`
Parent bool `json:"parent,omitempty"`
Private bool `json:"private,omitempty"`
Generic bool `json:"generic,omitempty"`
Slice bool `json:"slice,omitempty"`
Pointer bool `json:"pointer,omitempty"`
TypeParam []*TypeParam `json:"type_param,omitempty"`
Tag string `json:"tag,omitempty"`
Doc []*Comment `json:"doc,omitempty"`
Comment []*Comment `json:"comment,omitempty"`
Struct *Struct `json:"struct,omitempty"`
Package *Package `json:"package,omitempty"`
}
func (*Field) GetTagByName ¶
type File ¶
type File struct {
Name string `json:"name"`
Key string `json:"-"`
KeyHash string `json:"-"`
Package *Package `json:"package,omitempty"`
Comment []*Comment `json:"comment,omitempty"`
Import []*Import `json:"import,omitempty"`
Variable []*Variable `json:"variable,omitempty"`
Const []*Const `json:"const,omitempty"`
Function []*Function `json:"function,omitempty"`
Interface []*Interface `json:"interface,omitempty"`
Struct []*Struct `json:"struct,omitempty"`
}
func (*File) FindStruct ¶
func (*File) IsMainPackage ¶
type Function ¶
type Function struct {
Name string `json:"name"`
//Key string `json:"key"`
//KeyHash string `json:"key_hash"`
ElemType constants.ElemType `json:"elem_type,omitempty"`
TypeName string `json:"type_name"`
Doc []*Comment `json:"doc,omitempty"`
Private bool `json:"private,omitempty"`
Index int `json:"index"`
Package *Package `json:"package,omitempty"`
Generic bool `json:"generic,omitempty"`
TypeParam []*TypeParam `json:"type_param,omitempty"`
Param []*Param `json:"param,omitempty"`
Result []*Param `json:"result,omitempty"`
Receiver *Receiver `json:"receiver,omitempty"`
// contains filtered or unexported fields
}
func (*Function) GetCustomAttrs ¶
func (*Function) GetHttpMethodAttrs ¶
func (*Function) VisitParams ¶
func (*Function) VisitResults ¶
type Interface ¶
type Interface struct {
Index int `json:"index"`
Name string `json:"name"`
ElemType constants.ElemType `json:"elem_type"`
TypeName string `json:"type_name"`
TypeParam []*TypeParam `json:"type_param,omitempty"`
Function []*Function `json:"function,omitempty"`
Doc []*Comment `json:"doc,omitempty"`
Param []*Param `json:"param,omitempty"`
Result []*Param `json:"result,omitempty"`
}
type Package ¶
type Param ¶
type Param struct {
Index int `json:"index"`
Name string `json:"name"`
TypeName string `json:"type_name"`
ElemType constants.ElemType `json:"elem_type,omitempty"`
Package *Package `json:"package,omitempty"`
Type string `json:"type"`
Slice bool `json:"slice,omitempty"`
Pointer bool `json:"pointer,omitempty"`
Generic bool `json:"generic,omitempty"`
TypeParam []*TypeParam `json:"type_param,omitempty"`
Struct *Struct `json:"struct,omitempty"`
// contains filtered or unexported fields
}
type Project ¶
type Project struct {
ModPkg string `json:"mod_pkg,omitempty"`
BaseDir string `json:"base_dir,omitempty"`
ModName string `json:"mod_name,omitempty"`
ModVersion string `json:"mod_version,omitempty"`
ModPath string `json:"mod_path,omitempty"`
SdkPath string `json:"sdk_path,omitempty"`
Timestamp int64 `json:"timestamp,omitempty"`
Generator string `json:"generator,omitempty"`
Version string `json:"version,omitempty"`
FileMap map[string]*File `json:"file,omitempty"`
}
func (*Project) AfterParseProj ¶
func (p *Project) AfterParseProj()
func (*Project) FindStruct ¶
type Receiver ¶
type Receiver struct {
Name string `json:"name"`
Pointer bool `json:"pointer,omitempty"`
ElemType constants.ElemType `json:"elem_type,omitempty"`
Type string `json:"type"`
TypeName string `json:"type_name"`
Generic bool `json:"generic,omitempty"`
TypeParam []*TypeParam `json:"type_param,omitempty"`
Struct *Struct `json:"struct,omitempty"`
}
type Struct ¶
type Struct struct {
Name string `json:"name"`
Index int `json:"index"`
Key string `json:"-"`
KeyHash string `json:"-"`
TypeName string `json:"type_name"`
Type string `json:"type"`
Private bool `json:"private,omitempty"`
Generic bool `json:"generic,omitempty"`
Top bool `json:"top,omitempty"`
ElemType constants.ElemType `json:"elem_type"`
TypeParam []*TypeParam `json:"type_param,omitempty"`
Field []*Field `json:"field,omitempty"`
Doc []*Comment `json:"doc,omitempty"`
Comment []*Comment `json:"comment,omitempty"`
Method []*Function `json:"method,omitempty"`
Package *Package `json:"package,omitempty"`
Enum *Enum `json:"enum,omitempty"`
// contains filtered or unexported fields
}
func (*Struct) GetCustomAttrs ¶
func (*Struct) HasCustomAttr ¶
func (*Struct) HasParamAttr ¶
func (*Struct) VisitFields ¶
type TypeParam ¶
type TypeParam struct {
Type string `json:"type"`
TypeName string `json:"type_name"`
Index int `json:"index"`
ElemType constants.ElemType `json:"elem_type,omitempty"`
Pointer bool `json:"pointer,omitempty"`
Slice bool `json:"slice,omitempty"`
TypeInterface string `json:"type_interface,omitempty"`
Struct *Struct `json:"struct,omitempty"`
Package *Package `json:"package,omitempty"`
}
type Variable ¶
type Variable struct {
Name string `json:"name"`
ElemType constants.ElemType `json:"elem_type"`
Index int `json:"index"`
Value any `json:"value"`
Type string `json:"type"`
TypeName string `json:"type_name"`
Iota bool `json:"iota,omitempty"`
Package *Package `json:"package,omitempty"`
Struct *Struct `json:"struct,omitempty"`
Doc []*Comment `json:"doc,omitempty"`
Comment []*Comment `json:"comment,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.