Documentation ¶
Index ¶
- Variables
- func AddImport(root *ast.File, path string)
- func FetchFuncDecl(name string) *ast.FuncDecl
- func Field(n *ast.Ident, t ast.Expr) *ast.Field
- func FieldList(list ...*ast.Field) *ast.FieldList
- func FormatNode(fname string, node ast.Node) (*bytes.Buffer, error)
- func InventName(t ast.Expr, scope *ast.Scope) *ast.Ident
- func MappedFieldList(fn func(Arg) *ast.Field, args ...Arg) *ast.FieldList
- func NewAstFile(pkgname string) *ast.File
- func RegisterLayouter(name string, lay Layouter)
- func ScopeWith(names ...string) *ast.Scope
- func Sel(ids ...*ast.Ident) ast.Expr
- func StructDecl(name *ast.Ident, fields *ast.FieldList, comment ...*ast.CommentGroup) ast.Decl
- func TypeOf(tp interface{}) string
- type Arg
- type Iface
- type Layouter
- type Method
- func (m Method) FuncParams(scope *ast.Scope) *ast.FieldList
- func (m Method) FuncResults() *ast.FieldList
- func (m Method) RequestStruct() ast.Decl
- func (m Method) RequestStructName() (*ast.Ident, ast.Expr)
- func (m Method) ResponseStruct() ast.Decl
- func (m Method) ResponseStructFields() *ast.FieldList
- func (m Method) ResponseStructName() *ast.Ident
- func (m Method) WrapRequest() ast.Expr
- type SourceContext
Constants ¶
This section is empty.
Variables ¶
View Source
var NoLayouterError = errors.New("Layouter空")
Functions ¶
func FetchFuncDecl ¶
func NewAstFile ¶
func StructDecl ¶
Types ¶
type Arg ¶
type Iface ¶
type Layouter ¶
type Layouter interface {
TransformAST(ctx *SourceContext, filedir ...string) error
}
type Method ¶
type Method struct { Prefix string Name *ast.Ident Params []Arg Results []Arg Comments []string StructsResolved bool }
func (Method) FuncResults ¶
func (Method) RequestStruct ¶
func (Method) ResponseStruct ¶
func (Method) ResponseStructFields ¶
func (Method) ResponseStructName ¶
func (Method) WrapRequest ¶
type SourceContext ¶
type SourceContext struct { Pkg *ast.Ident Imports []*ast.ImportSpec Interfaces []Iface Types []*ast.TypeSpec Prefix string Common []*ast.Comment }
func ParseFileByLayoutName ¶
func ParseFileByLayoutName(source io.Reader, layname string, outfiledir ...string) (*SourceContext, error)
根据解析名称解析文件
func (*SourceContext) ImportDecls ¶
func (sc *SourceContext) ImportDecls(root *ast.File) (decls []ast.Decl)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.