Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AstInjectMeta ¶
type AstInjectMeta struct { Key string FilePath string ImportMetas []*ImportMeta // 导入包 StructMetas []*StructMeta // 结构体中插入属性 FuncMetas []*FuncMeta // 函数中插入代码 DeclMetas []*DeclMeta // 文件中插入定义声明 }
func (*AstInjectMeta) Inject ¶
func (vi *AstInjectMeta) Inject() error
func (*AstInjectMeta) RollBack ¶
func (vi *AstInjectMeta) RollBack() error
func (*AstInjectMeta) Walk ¶
func (vi *AstInjectMeta) Walk() error
type DeclMeta ¶
type DeclMeta struct { FuncName string //插入的方法 FuncPos int //插入的位置 Variables []string //左边的值 Symbol string //符号 IdentNames []string //右边的值,当为return时,是右边变量名 Parameters []interface{} //调用参数 Comments []string //注释 // contains filtered or unexported fields }
func NewDeclMeta ¶
type FuncMeta ¶
type FuncMeta struct { FuncName string //插入的方法 FuncPos int //插入的位置 Variables []string //左边的值 Symbol string //符号 IdentNames []string //右边的值,当为return时,是右边变量名 Parameters []interface{} //调用参数 Comments string //注释 // contains filtered or unexported fields }
Variables := IdentName.SelName(Parameters...) IdentName.SelName(Parameters...)
func NewFuncMete ¶
type ImportMeta ¶
type ImportMeta struct { ImportAlias string //导入别名 ImportPackage string //导入包路径 // contains filtered or unexported fields }
插入 import ImportAlias ImportPackage
func NewImportMete ¶
func NewImportMete(importCode string) *ImportMeta
func (*ImportMeta) GetCode ¶
func (vi *ImportMeta) GetCode() string
func (*ImportMeta) GetNode ¶
func (vi *ImportMeta) GetNode() dst.Node
type StructMeta ¶
type StructMeta struct { FindStructName string //在 struct FindStructName{ //插入 FieldName IdentName.SelName } FieldName string //元素别名 FieldIdent string //属性类型引用的包名 FieldType string //属性类型 FieldComment string //属性注释 // contains filtered or unexported fields }
插入 FieldName FieldType.SelName
func NewStructMete ¶
func NewStructMete(findStructName, importCode string) *StructMeta
func (*StructMeta) GetCode ¶
func (vi *StructMeta) GetCode() string
func (*StructMeta) GetNode ¶
func (vi *StructMeta) GetNode() dst.Node
Source Files ¶
Click to show internal directories.
Click to hide internal directories.