xipe

package module
v0.0.0-...-ea65422 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2022 License: MIT Imports: 7 Imported by: 0

README

xipe

useful abstractions over go ast

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	Name, Type, Tag string
}

type Func

type Func struct {
	// contains filtered or unexported fields
}

func (Func) AppendBeforeReturn

func (f Func) AppendBeforeReturn(stmts []ast.Stmt)

func (Func) LastReturnStmt

func (f Func) LastReturnStmt() *ast.ReturnStmt

type Interface

type Interface struct {
	// contains filtered or unexported fields
}

func (Interface) AppendMethod

func (i Interface) AppendMethod(name string, params []Field, results []Field) error

type NamedImport

type NamedImport struct {
	Name    string
	Package string
}

type StructType

type StructType struct {
	// contains filtered or unexported fields
}

func (StructType) AppendField

func (s StructType) AppendField(f Field)

func (StructType) FieldExists

func (s StructType) FieldExists(name string) bool

type Xipe

type Xipe struct {
	FileSet *token.FileSet
	// contains filtered or unexported fields
}

func New

func New(path string) (Xipe, error)

func (Xipe) AddDecls

func (x Xipe) AddDecls(dscls ...ast.Decl)

func (Xipe) AddImports

func (x Xipe) AddImports(imports ...string)

func (Xipe) AddNamedImports

func (x Xipe) AddNamedImports(namedImports ...NamedImport)

func (Xipe) FindFunc

func (x Xipe) FindFunc(name string) (Func, bool)

func (Xipe) FindInterface

func (x Xipe) FindInterface(name string) (Interface, bool)

func (Xipe) FindInterfaces

func (x Xipe) FindInterfaces() []Interface

func (Xipe) FindStructType

func (x Xipe) FindStructType(name string) (StructType, bool)

func (Xipe) GetAllTypeSpecs

func (x Xipe) GetAllTypeSpecs() map[string]*ast.TypeSpec

func (Xipe) Write

func (x Xipe) Write(w io.Writer) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL