Documentation ¶
Index ¶
- type AstInjectMeta
- type FuncMeta
- func (vi *FuncMeta) GetNode() dst.Node
- func (vi *FuncMeta) GetParameters() []dst.Expr
- func (vi *FuncMeta) GetSelector() dst.Expr
- func (vi *FuncMeta) GetVariables() []dst.Expr
- func (vi *FuncMeta) InjectCode() string
- func (vi *FuncMeta) RollBack(node dst.Node) dst.Visitor
- func (vi *FuncMeta) Visit(node dst.Node) dst.Visitor
- type ImportMeta
- type Meta
- type StructMeta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AstInjectMeta ¶
type AstInjectMeta struct { Key string FilePath string ImportMetas []*ImportMeta StructMetas []*StructMeta FuncMetas []*FuncMeta }
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 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 ¶
func (*FuncMeta) GetParameters ¶
func (*FuncMeta) GetSelector ¶
func (*FuncMeta) GetVariables ¶
func (*FuncMeta) InjectCode ¶
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) GetNode ¶
func (vi *ImportMeta) GetNode() dst.Node
func (*ImportMeta) InjectCode ¶
func (vi *ImportMeta) InjectCode() string
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) GetNode ¶
func (vi *StructMeta) GetNode() dst.Node
func (*StructMeta) InjectCode ¶
func (vi *StructMeta) InjectCode() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.