typast

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseRawAnnot added in v0.11.4

func ParseRawAnnot(raw string) (tagName, tagAttrs string)

ParseRawAnnot parse raw string to annotation

func StructTag added in v0.10.8

func StructTag(tag *ast.BasicLit) reflect.StructTag

StructTag create struct tag

Types

type AnnotateProject added in v0.10.12

type AnnotateProject struct {
	Walker     Walker
	Annotators []Annotator
}

AnnotateProject task

func (*AnnotateProject) Execute added in v0.10.12

func (a *AnnotateProject) Execute(c *typgo.Context) error

Execute annotation

func (*AnnotateProject) Task added in v0.11.1

func (a *AnnotateProject) Task() *typgo.Task

Task to annotate

type Annotation

type Annotation struct {
	Filter    Filter
	Processor Processor
}

func (*Annotation) Annotate added in v0.11.4

func (a *Annotation) Annotate() Processor

func (*Annotation) Process added in v0.11.4

func (a *Annotation) Process(c *typgo.Context, directives Directives) error

type Annotator added in v0.10.8

type Annotator interface {
	Annotate() Processor
}

type Decl added in v0.9.50

type Decl struct {
	File
	Type
}

Decl stand of declaration

type Directive added in v0.11.4

type Directive struct {
	TagName  string            `json:"tag_name"`
	TagParam reflect.StructTag `json:"tag_param"`
	*Decl    `json:"decl"`
}

Directive that contain extra additional information

func (*Directive) Package added in v0.11.4

func (d *Directive) Package() string

Package of annotation

type Directives added in v0.11.4

type Directives []*Directive

func (*Directives) AddDecl added in v0.11.4

func (s *Directives) AddDecl(file File, declType Type)

AddDecl add declaration

type Field added in v0.10.8

type Field struct {
	Names []string
	Type  string
	reflect.StructTag
}

Field information

type FieldList added in v0.10.8

type FieldList struct {
	List []*Field
}

FieldList function parameter

type File added in v0.10.8

type File struct {
	Path    string
	Package string
}

File information

type FilePaths added in v0.11.4

type FilePaths []string

func (FilePaths) Walk added in v0.11.4

func (f FilePaths) Walk() []string

type Filter added in v0.11.4

type Filter interface {
	IsAllowed(d *Directive) bool
}

type Filters added in v0.11.4

type Filters []Filter

func (Filters) IsAllowed added in v0.11.4

func (f Filters) IsAllowed(d *Directive) bool

type FuncDecl added in v0.10.8

type FuncDecl struct {
	Name   string
	Docs   []string
	Recv   *FieldList
	Params *FieldList
}

FuncDecl function declaration

func (*FuncDecl) GetDocs added in v0.10.8

func (f *FuncDecl) GetDocs() []string

GetDocs comment documentation

func (*FuncDecl) GetName added in v0.10.8

func (f *FuncDecl) GetName() string

GetName of declaration

func (*FuncDecl) IsMethod added in v0.10.8

func (f *FuncDecl) IsMethod() bool

IsMethod return true if function is method (has receiver argument)

type FuncFilter added in v0.11.4

type FuncFilter struct{}

func (*FuncFilter) IsAllowed added in v0.11.4

func (*FuncFilter) IsAllowed(d *Directive) bool

type GenDecl added in v0.10.8

type GenDecl struct {
	Docs []string
}

GenDecl generic declaration

type ImportAliases added in v0.10.23

type ImportAliases struct {
	Map map[string]string // key is import package , value is import alias
	// contains filtered or unexported fields
}

ImportAliases ...

func NewImportAliases added in v0.10.23

func NewImportAliases() *ImportAliases

NewImportAliases return new constructor of ImportAliasess

func (*ImportAliases) Append added in v0.10.23

func (i *ImportAliases) Append(pkg string) string

Append package to map

type InterfaceDecl added in v0.10.8

type InterfaceDecl struct {
	TypeDecl
}

InterfaceDecl interface declaration

type InterfaceFilter added in v0.11.4

type InterfaceFilter struct{}

func (*InterfaceFilter) IsAllowed added in v0.11.4

func (*InterfaceFilter) IsAllowed(d *Directive) bool

type Layouts added in v0.11.4

type Layouts []string

func (Layouts) Walk added in v0.11.4

func (l Layouts) Walk() []string

type NewFilter added in v0.11.4

type NewFilter func(d *Directive) bool

func (NewFilter) IsAllowed added in v0.11.4

func (n NewFilter) IsAllowed(d *Directive) bool

type NewProcessor added in v0.11.4

type NewProcessor func(*typgo.Context, Directives) error

func (NewProcessor) Process added in v0.11.4

func (p NewProcessor) Process(c *typgo.Context, d Directives) error

type Processor added in v0.11.4

type Processor interface {
	Process(*typgo.Context, Directives) error
}

type PublicFilter added in v0.11.4

type PublicFilter struct{}

func (*PublicFilter) IsAllowed added in v0.11.4

func (*PublicFilter) IsAllowed(d *Directive) bool

type Signature added in v0.10.8

type Signature struct {
	TagName string
}

Signature for code generation by annotation

func (Signature) String added in v0.10.8

func (s Signature) String() string

type StructDecl added in v0.10.8

type StructDecl struct {
	TypeDecl
	Fields []*Field
}

StructDecl struct declaration

type StructFilter added in v0.11.4

type StructFilter struct{}

func (*StructFilter) IsAllowed added in v0.11.4

func (*StructFilter) IsAllowed(d *Directive) bool

type TagNameFilter added in v0.11.4

type TagNameFilter []string

func (TagNameFilter) IsAllowed added in v0.11.4

func (t TagNameFilter) IsAllowed(d *Directive) bool

type Type added in v0.10.8

type Type interface {
	GetName() string
	GetDocs() []string
}

Type declaratio type

type TypeDecl added in v0.10.8

type TypeDecl struct {
	GenDecl
	Name string
	Docs []string
}

TypeDecl type declaration

func (*TypeDecl) GetDocs added in v0.10.8

func (t *TypeDecl) GetDocs() []string

GetDocs get doc

func (*TypeDecl) GetName added in v0.10.8

func (t *TypeDecl) GetName() string

GetName get name

type Walker added in v0.11.4

type Walker interface {
	Walk() []string
}

Jump to

Keyboard shortcuts

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