extractor

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoesStructEmbedStruct

func DoesStructEmbedStruct(
	sourceFile *ast.File,
	structFullPackageName string,
	structNode *ast.StructType,
	embeddedStructName string,
) bool

func DoesStructEmbedType

func DoesStructEmbedType(pkg *packages.Package, structName string, embeddedStructFullPackage string, embeddedStructName string) (bool, error)

func DoesTypeOrInterfaceExistInPackage

func DoesTypeOrInterfaceExistInPackage(
	packages []*packages.Package,
	packageFullName string,
	ident *ast.Ident,
) (bool, definitions.AstNodeKind, error)

func FilterPackageByFullName

func FilterPackageByFullName(packages []*packages.Package, fullName string) *packages.Package

func FindAndExtract

func FindAndExtract(input []string, search string) string

func FindAndExtractOccurrences

func FindAndExtractOccurrences(input []string, search string, maxMatchCount uint) []string

func FindGenDeclByIdent added in v1.0.4

func FindGenDeclByIdent(fileSet *token.FileSet, file *ast.File, ident *ast.Ident) *ast.GenDecl

func FindGenDeclByName

func FindGenDeclByName(pkg *packages.Package, typeSpecName string) *ast.GenDecl

func FindTypesStructInPackage

func FindTypesStructInPackage(pkg *packages.Package, structName string) (*types.Struct, error)

func GetAllPackageFiles

func GetAllPackageFiles(codeFiles []*ast.File, fileSet *token.FileSet, fullPackageNameToFind string) ([]*ast.File, error)

func GetCommentsFromIdent

func GetCommentsFromIdent(files *token.FileSet, file *ast.File, ident *ast.Ident) []string

func GetDefaultAlias

func GetDefaultAlias(fullyQualifiedPackage string) string

func GetDefaultPackageAlias

func GetDefaultPackageAlias(file *ast.File) (string, error)

func GetDotImportedPackageNames

func GetDotImportedPackageNames(file *ast.File) []string

func GetFieldMetadata

func GetFieldMetadata(
	file *ast.File,
	fileSet *token.FileSet,
	packages []*packages.Package,
	value *ast.Field,
) (definitions.TypeMetadata, error)

func GetFieldTypeString added in v1.0.3

func GetFieldTypeString(fieldType ast.Expr) string

func GetFileByImportNode

func GetFileByImportNode(codeFiles []*ast.File, fileSet *token.FileSet, importNode *ast.ImportSpec) (*ast.File, error)

func GetFullPackageName

func GetFullPackageName(file *ast.File, fileSet *token.FileSet) (string, error)

func GetFuncParameterTypeList

func GetFuncParameterTypeList(
	file *ast.File,
	fileSet *token.FileSet,
	packages []*packages.Package,
	funcDecl *ast.FuncDecl,
) ([]definitions.ParamMeta, error)

func GetFuncReturnTypeList

func GetFuncReturnTypeList(
	file *ast.File,
	fileSet *token.FileSet,
	packages []*packages.Package,
	funcDecl *ast.FuncDecl,
) ([]definitions.TypeMetadata, error)

func GetImportAliases

func GetImportAliases(file *ast.File) map[string]string

func GetNodeKind added in v1.0.3

func GetNodeKind(fieldType ast.Expr) definitions.AstNodeKind

func GetPackageAndDependencies

func GetPackageAndDependencies(
	codeFiles []*ast.File,
	fileSet *token.FileSet,
	fullPackageNameToFind string,
	relevantFilesOutput *MapSet.Set[*ast.File],
) error

func GetPackagesFromExpressions

func GetPackagesFromExpressions(packageExpressions []string) ([]*packages.Package, error)

func GetStructFromGenDecl

func GetStructFromGenDecl(decl *ast.GenDecl) *ast.StructType

func GetTypeMetaByIdent

func GetTypeMetaByIdent(
	file *ast.File,
	fileSet *token.FileSet,
	packages []*packages.Package,
	ident *ast.Ident,
) (definitions.TypeMetadata, error)

func GetTypeMetaBySelectorExpr

func GetTypeMetaBySelectorExpr(
	file *ast.File,
	fileSet *token.FileSet,
	packages []*packages.Package,
	selector *ast.SelectorExpr,
) (definitions.TypeMetadata, error)

func IsAliasDefault

func IsAliasDefault(fullPackageName string, alias string) bool

func IsFuncDeclReceiverForStruct

func IsFuncDeclReceiverForStruct(structName string, funcDecl *ast.FuncDecl) bool

func IsIdentInPackage

func IsIdentInPackage(pkg *packages.Package, ident *ast.Ident) bool

func IsPackageDotImported

func IsPackageDotImported(file *ast.File, packageName string) (bool, string)

func IsUniverseType

func IsUniverseType(typeName string) bool

func LookupTypeName added in v1.0.3

func LookupTypeName(pkg *packages.Package, name string) (*types.TypeName, error)

func MapDocListToStrings

func MapDocListToStrings(docList []*ast.Comment) []string

MapDocListToStrings converts a list of comment nodes (ast.Comment) to a string array

func TryGetStructOrInterfaceKind added in v1.0.3

func TryGetStructOrInterfaceKind(pkg *packages.Package, name string) (definitions.AstNodeKind, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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