Documentation
¶
Index ¶
- Variables
- func CastToType[T Type](val any) (*T, bool)
- func GetFuncDeclAllImportPath(funcDecl *FuncDecl) ([]string, error)
- func GetPackagePath(pkgDir string) (string, error)
- func GetTypeDeclAllImportPath(typeDecl *TypeDecl) ([]string, error)
- func InitSelfPackageImports(targetPackage string, packageList ...*Package) error
- func InspectFields(fieldList []*Field, fn func(*Field) error) error
- func InspectFuncDeclFields(funcDecl *FuncDecl, fn func(*Field) error) error
- func InspectType(t Type, fn func(Type) error) error
- func InspectTypeDeclTypes(typeDecl *TypeDecl, fn func(Type) error) error
- func IsExported(name string) bool
- func ReplaceImportAliasByImportPath(t Type, importList ImportList) error
- func SetPackageInformation(t Type, imports ImportList) error
- func SetPackagePathForAllDecl(pkg *Package) error
- type ArrayType
- type ChanType
- type EllipsisType
- type Field
- type FuncDecl
- type FuncDeclList
- type FuncType
- type Ident
- type Import
- type ImportList
- type IndexExpr
- type InterfaceType
- type MapType
- type Package
- type PackageCarrierType
- type PackageGetterType
- type PackageSetterType
- type SelectorExpr
- type StarExpr
- type StructType
- type Type
- type TypeDecl
- type TypeDeclList
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrImportNotFound = errors.New("import not found")
Functions ¶
func CastToType ¶
func GetPackagePath ¶
func InitSelfPackageImports ¶
func InspectFuncDeclFields ¶
func InspectTypeDeclTypes ¶
func IsExported ¶
func ReplaceImportAliasByImportPath ¶
func ReplaceImportAliasByImportPath(t Type, importList ImportList) error
func SetPackageInformation ¶
func SetPackageInformation(t Type, imports ImportList) error
Types ¶
type ArrayType ¶
type ArrayType struct {
Type Type
}
func (ArrayType) ExprString ¶
func (ArrayType) Imports ¶ added in v1.0.2
func (t ArrayType) Imports() ImportList
type ChanType ¶
func (ChanType) ExprString ¶
func (ChanType) Imports ¶ added in v1.0.2
func (t ChanType) Imports() ImportList
type EllipsisType ¶
type EllipsisType struct {
Type Type
}
func (EllipsisType) ExprString ¶
func (t EllipsisType) ExprString() string
func (EllipsisType) Imports ¶ added in v1.0.2
func (t EllipsisType) Imports() ImportList
func (EllipsisType) String ¶
func (t EllipsisType) String() string
type Field ¶
func NewFieldList ¶
type FuncDecl ¶
type FuncDecl struct {
Receiver string
Name string
Comment string
Params []*Field
Results []*Field
}
func NewFuncDecl ¶
func (FuncDecl) GetSignatureImports ¶ added in v1.0.2
func (t FuncDecl) GetSignatureImports() ImportList
type FuncDeclList ¶
type FuncDeclList []*FuncDecl
func (FuncDeclList) GetByReceiverName ¶
func (l FuncDeclList) GetByReceiverName(name string) FuncDeclList
type FuncType ¶
func (FuncType) ExprString ¶
func (FuncType) Imports ¶ added in v1.0.2
func (t FuncType) Imports() ImportList
type Ident ¶
func (Ident) ExprString ¶
func (Ident) GetPackage ¶
func (Ident) GetPackagePath ¶
func (Ident) Imports ¶ added in v1.0.2
func (t Ident) Imports() ImportList
func (*Ident) SetPackage ¶
type ImportList ¶
type ImportList []Import
func GetAllPackagesImports ¶
func GetAllPackagesImports(baseImportPath []string, packageList ...*Package) (ImportList, error)
func NewImportList ¶
func NewImportList(imports []*ast.ImportSpec) ImportList
func NewImportListWithUniqAlias ¶
func NewImportListWithUniqAlias(importPathList []string) (ImportList, error)
type IndexExpr ¶ added in v1.0.1
func (IndexExpr) ExprString ¶ added in v1.0.1
func (IndexExpr) Imports ¶ added in v1.0.2
func (t IndexExpr) Imports() ImportList
type InterfaceType ¶
type InterfaceType struct {
Methods []*Field
}
func (InterfaceType) ExprString ¶
func (t InterfaceType) ExprString() string
func (InterfaceType) Imports ¶ added in v1.0.2
func (t InterfaceType) Imports() ImportList
func (InterfaceType) String ¶
func (t InterfaceType) String() string
type MapType ¶
func (MapType) ExprString ¶
func (MapType) Imports ¶ added in v1.0.2
func (t MapType) Imports() ImportList
type Package ¶
type Package struct {
Path string
Dir string
TypeDeclList TypeDeclList
FuncDeclList FuncDeclList
}
func ParsePackage ¶
type PackageCarrierType ¶
type PackageCarrierType interface {
PackageGetterType
PackageSetterType
}
type PackageGetterType ¶
type PackageSetterType ¶
type PackageSetterType interface {
SetPackage(Import)
}
type SelectorExpr ¶
func (SelectorExpr) ExprString ¶
func (t SelectorExpr) ExprString() string
func (SelectorExpr) GetPackage ¶
func (t SelectorExpr) GetPackage() string
func (SelectorExpr) GetPackagePath ¶
func (t SelectorExpr) GetPackagePath() string
func (SelectorExpr) Imports ¶ added in v1.0.2
func (t SelectorExpr) Imports() ImportList
func (*SelectorExpr) SetPackage ¶
func (t *SelectorExpr) SetPackage(i Import)
func (SelectorExpr) String ¶
func (t SelectorExpr) String() string
type StarExpr ¶
type StarExpr struct {
Type Type
}
func (StarExpr) ExprString ¶
func (StarExpr) Imports ¶ added in v1.0.2
func (t StarExpr) Imports() ImportList
type StructType ¶
type StructType struct {
Fields []*Field
}
func (StructType) ExprString ¶
func (t StructType) ExprString() string
func (StructType) Imports ¶ added in v1.0.2
func (t StructType) Imports() ImportList
func (StructType) String ¶
func (t StructType) String() string
type Type ¶
type Type interface {
String() string
ExprString() string
Imports() ImportList
}
type TypeDecl ¶
func NewTypeDecl ¶
func (TypeDecl) GetFieldsImports ¶ added in v1.0.2
func (t TypeDecl) GetFieldsImports() ImportList
type TypeDeclList ¶
type TypeDeclList []*TypeDecl
func NewTypeDeclList ¶
func NewTypeDeclList(pkg string, generalDecl *ast.GenDecl) TypeDeclList
Click to show internal directories.
Click to hide internal directories.