astdata

package
v0.0.0-...-31c2986 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayType

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

ArrayType is the base array

func (*ArrayType) Compare

func (a *ArrayType) Compare(def Definition) bool

Compare try to compare this to def

func (*ArrayType) Expr

func (a *ArrayType) Expr() ast.Expr

Expr is the expr from ast

func (ArrayType) File

func (ed ArrayType) File() *File

func (*ArrayType) Len

func (a *ArrayType) Len() int

Len is the len of this array

func (ArrayType) Node

func (ed ArrayType) Node() ast.Node

func (ArrayType) Package

func (ed ArrayType) Package() *Package

func (*ArrayType) Slice

func (a *ArrayType) Slice() bool

Slice means this array is an slice

func (*ArrayType) String

func (a *ArrayType) String() string

String represent array in string

func (*ArrayType) ValueDefinition

func (a *ArrayType) ValueDefinition() Definition

ValueDefinition return the definition of value

type ChanDir

type ChanDir int

ChanDir The direction of a channel type is indicated by a bit mask including one or both of the following constants.

const (
	// SEND is send only channel
	SEND ChanDir = 1 << iota
	// RECV is the receive only channel
	RECV
)

type ChannelType

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

ChannelType is the channel type in go source code

func (*ChannelType) Compare

func (c *ChannelType) Compare(def Definition) bool

Compare try to compare this to def

func (*ChannelType) Direction

func (c *ChannelType) Direction() ChanDir

Direction return the channel direction

func (ChannelType) File

func (ed ChannelType) File() *File

func (ChannelType) Node

func (ed ChannelType) Node() ast.Node

func (ChannelType) Package

func (ed ChannelType) Package() *Package

func (*ChannelType) String

func (c *ChannelType) String() string

String represent string version of the data

func (*ChannelType) ValueDefinition

func (c *ChannelType) ValueDefinition() Definition

ValueDefinition return the definition of the type in channel

type Constant

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

Constant is a string represent of a function parameter

func (*Constant) Definition

func (c *Constant) Definition() Definition

Definition return the constant definition

func (*Constant) Docs

func (c *Constant) Docs() Docs

Docs is the documents of the constant

func (*Constant) File

func (c *Constant) File() *File

File return the constant declaration file

func (*Constant) Name

func (c *Constant) Name() string

Name return the name of constant

func (*Constant) Package

func (c *Constant) Package() *Package

Package return the constant package

func (*Constant) Value

func (c *Constant) Value() string

Value is the value of the constant (not very accurate , the iota is not supported)

type Definition

type Definition interface {
	fmt.Stringer
	// Package return the package name of the type
	Package() *Package
	// Compare two definition
	// TODO : this is here, but the implementation is not complete. for {Selector,Map,Struct,Interface,Func}Type we need to check for selector type canonical name and pkg name
	Compare(Definition) bool
	// Node return the original ast node
	Node() ast.Node
}

Definition is the interface for all types without name

func NewDefinition

func NewDefinition(s string) (Definition, error)

NewDefinition try to extract definition from string

type Docs

type Docs []string

Docs is the code documents

func (Docs) String

func (d Docs) String() string

String convert object to go docs again

type EllipsisType

type EllipsisType struct {
	*ArrayType
}

EllipsisType is slice type but with ...type definition

func (*EllipsisType) Compare

func (e *EllipsisType) Compare(def Definition) bool

Compare try to compare this to def

func (EllipsisType) File

func (ed EllipsisType) File() *File

func (EllipsisType) Node

func (ed EllipsisType) Node() ast.Node

func (EllipsisType) Package

func (ed EllipsisType) Package() *Package

func (*EllipsisType) String

func (e *EllipsisType) String() string

String represent ellipsis array in string

type Embed

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

Embed is the embedded type in the struct or interface

func (*Embed) Definition

func (e *Embed) Definition() Definition

Definition of the embed item

func (*Embed) Docs

func (e *Embed) Docs() Docs

Docs return the document of the field

func (*Embed) String

func (e *Embed) String() string

func (*Embed) Tags

func (e *Embed) Tags() reflect.StructTag

Tags return the struct tags of the field

type Embeds

type Embeds []*Embed

Embeds is a list of embedded items

type Field

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

Field is a single field of a structure, a variable, with tag

func (*Field) Definition

func (f *Field) Definition() Definition

Definition of the field

func (*Field) Docs

func (f *Field) Docs() Docs

Docs return the document of the field

func (*Field) Name

func (f *Field) Name() string

Name is the field name

func (*Field) Tags

func (f *Field) Tags() reflect.StructTag

Tags return the struct tags of the field

type Fields

type Fields []*Field

Fields a list of fields

type File

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

File is a single file in a structure

func ParseFile

func ParseFile(src string, p *Package) (*File, error)

ParseFile try to parse a single file for its annotations

func (*File) Docs

func (f *File) Docs() Docs

Docs return the documents of the file

func (*File) FileName

func (f *File) FileName() string

FileName return the file name, no path

func (*File) FindConstant

func (f *File) FindConstant(t string) (*Constant, error)

FindConstant try to find constant in package

func (*File) FindFunction

func (f *File) FindFunction(t string) (*Function, error)

FindFunction try to find function in file

func (*File) FindImport

func (f *File) FindImport(pkg string) (*Import, error)

FindImport try to find an import in a file

func (*File) FindMethod

func (f *File) FindMethod(t string, fn string) (*Function, error)

FindMethod try to find function in file

func (*File) FindType

func (f *File) FindType(t string) (*Type, error)

FindType try to find type in file

func (*File) FindVariable

func (f *File) FindVariable(t string) (*Variable, error)

FindVariable try to find variable in file

func (*File) FullPath

func (f *File) FullPath() string

FullPath return the file full path

func (*File) Package

func (f *File) Package() *Package

Package return the package of the file

func (*File) Source

func (f *File) Source() string

Source return the file source

type FuncType

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

FuncType is the single function

func (*FuncType) Compare

func (f *FuncType) Compare(def Definition) bool

Compare try to compare this to def

func (FuncType) File

func (ed FuncType) File() *File

func (FuncType) Node

func (ed FuncType) Node() ast.Node

func (FuncType) Package

func (ed FuncType) Package() *Package

func (*FuncType) Parameters

func (f *FuncType) Parameters() []*Variable

Parameters is the parameter of the function

func (*FuncType) Results

func (f *FuncType) Results() []*Variable

Results is the result of the functions

func (*FuncType) Sign

func (f *FuncType) Sign() string

Sign return the function sign

func (*FuncType) String

func (f *FuncType) String() string

String is the string representation of func type

type Function

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

Function is functions with name, not the func types

func (*Function) Body

func (f *Function) Body() string

Body return the function body

func (*Function) Definition

func (f *Function) Definition() Definition

Definition return the definition of the func

func (*Function) Docs

func (f *Function) Docs() Docs

Docs get the function docs +lazy

func (*Function) File

func (f *Function) File() *File

File get the file of function

func (*Function) Func

func (f *Function) Func() *FuncType

Func return the definition in correct cast. for faster access without a cast

func (*Function) Name

func (f *Function) Name() string

Name return the name of the function

func (*Function) Package

func (f *Function) Package() *Package

Package get the package of function

func (*Function) Receiver

func (f *Function) Receiver() *Variable

Receiver get the receiver of the function if the function is a method, if not, return nil

func (*Function) ReceiverType

func (f *Function) ReceiverType() string

ReceiverType return the type of the receiver

func (*Function) RecieverPointer

func (f *Function) RecieverPointer() bool

RecieverPointer means this is a pointer method

type IdentType

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

IdentType is the normal type name

func (*IdentType) Compare

func (i *IdentType) Compare(def Definition) bool

Compare try to compare this to def

func (IdentType) File

func (ed IdentType) File() *File

func (*IdentType) Ident

func (i *IdentType) Ident() string

Ident is the ident of this type

func (IdentType) Node

func (ed IdentType) Node() ast.Node

func (IdentType) Package

func (ed IdentType) Package() *Package

func (*IdentType) String

func (i *IdentType) String() string

type Import

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

Import is one imported path

func (*Import) Canonical

func (i *Import) Canonical() string

Canonical is the canonical package name, if the package not imported with another name, the package name and canonical name are same +lazy

func (*Import) Docs

func (i *Import) Docs() Docs

Docs is the docs for this import path

func (*Import) File

func (i *Import) File() *File

File return the file where the import is inside it

func (*Import) Folder

func (i *Import) Folder() string

Folder return the actual folder name of the package +lazy

func (*Import) Package

func (i *Import) Package() *Package

Package is the package where the import is inside it

func (*Import) Path

func (i *Import) Path() string

Path is the target package in full path format

func (*Import) TargetPackage

func (i *Import) TargetPackage() string

TargetPackage return the target package name. (name after package keyword in package ) +lazy

type InterfaceType

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

InterfaceType is the interface in go code

func (*InterfaceType) Compare

func (i *InterfaceType) Compare(def Definition) bool

Compare try to compare this to def

func (*InterfaceType) Embeds

func (i *InterfaceType) Embeds() Embeds

Embeds is the embedded interfaces

func (InterfaceType) File

func (ed InterfaceType) File() *File

func (*InterfaceType) Functions

func (i *InterfaceType) Functions() []*Function

Functions return the functions in the interface

func (InterfaceType) Node

func (ed InterfaceType) Node() ast.Node

func (InterfaceType) Package

func (ed InterfaceType) Package() *Package

func (*InterfaceType) String

func (i *InterfaceType) String() string

type MapType

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

MapType is the map in the go code

func (*MapType) Compare

func (m *MapType) Compare(def Definition) bool

Compare try to compare this to def

func (MapType) File

func (ed MapType) File() *File

func (*MapType) Key

func (m *MapType) Key() Definition

Key type definition

func (MapType) Node

func (ed MapType) Node() ast.Node

func (MapType) Package

func (ed MapType) Package() *Package

func (*MapType) String

func (m *MapType) String() string

func (*MapType) Val

func (m *MapType) Val() Definition

Val is the definition of the value type

type Package

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

Package is the package in one place

func ParsePackage

func ParsePackage(path string, packages ...string) (*Package, error)

ParsePackage is here for loading a single package and parse all files in it if the package is imported from another package, the other parameter is required for checking vendors of that package.

func (*Package) Constants

func (p *Package) Constants() []*Constant

Constants return the constants of the package

func (*Package) Files

func (p *Package) Files() []*File

Files return files of this package

func (*Package) FindConstant

func (p *Package) FindConstant(t string) (*Constant, error)

FindConstant try to find constant in package

func (*Package) FindFunction

func (p *Package) FindFunction(t string) (*Function, error)

FindFunction try to find function in package

func (*Package) FindImport

func (p *Package) FindImport(pkg string) (*Import, error)

FindImport try to find an import in a package

func (*Package) FindMethod

func (p *Package) FindMethod(t string, fn string) (*Function, error)

FindMethod try to find function in package

func (*Package) FindType

func (p *Package) FindType(t string) (*Type, error)

FindType try to find type in package

func (*Package) FindVariable

func (p *Package) FindVariable(t string) (*Variable, error)

FindVariable try to find variable in package

func (*Package) Functions

func (p *Package) Functions() []*Function

Functions return the list of package functions

func (*Package) Imports

func (p *Package) Imports() []*Import

Imports return all imports of the package

func (*Package) Name

func (p *Package) Name() string

Name of the package

func (*Package) Path

func (p *Package) Path() string

Path of the package

func (*Package) Types

func (p *Package) Types() []*Type

Types return the types in package

func (*Package) Variables

func (p *Package) Variables() []*Variable

Variables return the list of package variables

type SelectorType

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

SelectorType is the type in another package

func (*SelectorType) Compare

func (s *SelectorType) Compare(def Definition) bool

Compare try to compare this to def

func (SelectorType) File

func (ed SelectorType) File() *File

func (*SelectorType) Ident

func (s *SelectorType) Ident() string

Ident is the ident after dot

func (*SelectorType) Import

func (s *SelectorType) Import() *Import

Import is the import of this selector

func (SelectorType) Node

func (ed SelectorType) Node() ast.Node

func (SelectorType) Package

func (ed SelectorType) Package() *Package

func (*SelectorType) Selector

func (s *SelectorType) Selector() string

Selector is the selector type

func (*SelectorType) String

func (s *SelectorType) String() string

type StarType

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

StarType is the pointer of a type

func (*StarType) Compare

func (s *StarType) Compare(def Definition) bool

Compare try to compare this to def

func (StarType) File

func (ed StarType) File() *File

func (StarType) Node

func (ed StarType) Node() ast.Node

func (StarType) Package

func (ed StarType) Package() *Package

func (*StarType) String

func (s *StarType) String() string

func (*StarType) Target

func (s *StarType) Target() Definition

Target is the target type of this star type

type StructType

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

StructType is the structures in golang source code

func (*StructType) Compare

func (s *StructType) Compare(def Definition) bool

Compare try to compare this to def

func (*StructType) Embeds

func (s *StructType) Embeds() Embeds

Embeds is the embed structures

func (*StructType) Fields

func (s *StructType) Fields() Fields

Fields return struct fields

func (StructType) File

func (ed StructType) File() *File

func (StructType) Node

func (ed StructType) Node() ast.Node

func (StructType) Package

func (ed StructType) Package() *Package

func (*StructType) String

func (s *StructType) String() string

String convert struct to string

type Type

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

Type is the type with name in a package

func (*Type) Definition

func (t *Type) Definition() Definition

Definition return the definition of this type

func (*Type) Docs

func (t *Type) Docs() Docs

Docs return the documents

func (*Type) File

func (t *Type) File() *File

File return the filename of this type name

func (*Type) Name

func (t *Type) Name() string

Name is the type name

func (*Type) Package

func (t *Type) Package() *Package

Package return the package name of this type name

type Variable

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

Variable is a string represent of a function parameter

func (*Variable) Definition

func (v *Variable) Definition() Definition

Definition return the variable definition

func (*Variable) Docs

func (v *Variable) Docs() Docs

Docs return the variable document

func (*Variable) File

func (v *Variable) File() *File

File the filename of this variable

func (*Variable) Name

func (v *Variable) Name() string

Name return the name of variable

func (*Variable) Package

func (v *Variable) Package() *Package

Package the package name of this variable

Jump to

Keyboard shortcuts

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