parserz

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	Names []string   // 名称,这里可能有多个,例如:a, b, c int
	Type  *FieldType // 类型
	// contains filtered or unexported fields
}

func NewField

func NewField(pkg *Pkg, importManager ImportManager, astField *ast.Field) *Field

func (*Field) ImportPaths

func (f *Field) ImportPaths() []string

func (*Field) String

func (f *Field) String() string

type FieldType

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

func NewFieldType

func NewFieldType(pkg *Pkg, importManager ImportManager, astType ast.Expr) *FieldType

func (*FieldType) ImportPaths

func (f *FieldType) ImportPaths() []string

func (*FieldType) Name

func (f *FieldType) Name() string

func (*FieldType) String

func (f *FieldType) String() string

type Func

type Func struct {
	Rec     *Field
	Params  []*Field
	Results []*Field
	// contains filtered or unexported fields
}

func NewFunc

func NewFunc(pkg *Pkg, importManager ImportManager, name string, astFunc *ast.FuncType, rec *ast.Field) *Func

func (*Func) ImportPaths

func (i *Func) ImportPaths() []string

func (*Func) InterfaceFormat

func (i *Func) InterfaceFormat() string

InterfaceFormat 转成接口方法格式

func (*Func) Name

func (i *Func) Name() string

type Import

type Import struct {
	Path  string
	Alias string
}

type ImportManager

type ImportManager interface {
	All() []*Import
	GetImportByPath(path string) *Import
	GetImportByAlias(alias string) *Import
}

type Option added in v0.1.2

type Option func(o *PkgBuilder)

func WithFilter added in v0.1.2

func WithFilter(filter func(info os.FileInfo) bool) Option

func WithPath added in v0.1.2

func WithPath(path string) Option

type Pkg

type Pkg struct {
	//Vars   []*Field
	//Const  []*Field
	Imports ImportManager
	Struct  []*Struct
	Func    []*Func
	// contains filtered or unexported fields
}

func (*Pkg) Name

func (p *Pkg) Name() string

func (*Pkg) Read

func (p *Pkg) Read(pos, end token.Pos) string

type PkgBuilder

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

func NewPkgBuilder

func NewPkgBuilder(options ...Option) *PkgBuilder

func (*PkgBuilder) Build

func (p *PkgBuilder) Build() (*Pkg, error)

func (*PkgBuilder) WithPkgPath deprecated

func (p *PkgBuilder) WithPkgPath(path string) *PkgBuilder

Deprecated: use WithPath instead

type Struct

type Struct struct {
	Name   string
	Fields []*Field
	// contains filtered or unexported fields
}

func NewStruct

func NewStruct(pkg *Pkg, importManager ImportManager, name string, astSpec *ast.StructType) *Struct

Jump to

Keyboard shortcuts

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