Documentation ¶
Index ¶
- func BuildRestMetadata(comments []string) definitions.RestMetadata
- func DoesStructEmbedStruct(sourceFile *ast.File, structFullPackageName string, structNode *ast.StructType, ...) bool
- func DoesStructEmbedStructByName(structNode *ast.StructType, embeddedStructName string) bool
- func DoesTypeOrInterfaceExistInPackage(packages []*packages.Package, packageFullName string, ident *ast.Ident) (bool, bool)
- func EmbedsBaseStruct(structType *ast.StructType, baseStruct string) bool
- func ExtractClassMetadata(d ast.GenDecl, baseStruct string) (*definitions.ControllerMetadata, error)
- func ExtractClassRoutesMetaData(routeFuncDecl ast.FuncDecl) (*definitions.RouteMetadata, error)
- func ExtractFuncReturnTypes(d ast.FuncDecl) (string, definitions.FuncReturnSignature, error)
- func ExtractMetadata() ([]definitions.ControllerMetadata, error)
- func ExtractParamTerm(line string) string
- func ExtractParenthesesContent(line string) string
- func FilterDecls(decls []ast.Decl, check func(ast.Decl) bool) []ast.Decl
- func FilterPackageByFullName(packages []*packages.Package, fullName string) *packages.Package
- func FindAndExtract(input []string, search string) string
- func FindAndExtractArray(input []string, search string) []string
- func FindAndExtractOccurrences(input []string, search string, maxMatchCount uint) []string
- func GetAllPackageFiles(codeFiles []*ast.File, fileSet *token.FileSet, fullPackageNameToFind string) ([]*ast.File, error)
- func GetCommentsFromIdent(ident *ast.Ident) []string
- func GetDefaultAlias(fullyQualifiedPackage string) string
- func GetDefaultPackageAlias(file *ast.File) (string, error)
- func GetDotImportedPackageNames(file *ast.File) []string
- func GetFieldUsageType(file *ast.File, fileSet *token.FileSet, packages []*packages.Package, ...) (definitions.TypeMetadata, error)
- func GetFileByImportNode(codeFiles []*ast.File, fileSet *token.FileSet, importNode *ast.ImportSpec) (*ast.File, error)
- func GetFullPackageName(file *ast.File, fileSet *token.FileSet) (string, error)
- func GetFuncReturnTypeList(file *ast.File, fileSet *token.FileSet, packages []*packages.Package, ...)
- func GetImportAliases(file *ast.File) map[string]string
- func GetMetadata()
- func GetPackageAndDependencies(codeFiles []*ast.File, fileSet *token.FileSet, fullPackageNameToFind string, ...) error
- func GetPackagesFromExpressions(packageExpressions []string) ([]*packages.Package, error)
- func GetResponseInterface(file *ast.File, fileSet *token.FileSet, funcDecl ast.FuncDecl) definitions.ResponseMetadata
- func GetTextAfterParenthesis(input string, splitter string) string
- func GetTextBeforeParenthesis(input string, splitter string) string
- func GetTypeMetaByIdent(file *ast.File, fileSet *token.FileSet, packages []*packages.Package, ...) (definitions.TypeMetadata, error)
- func GetTypeMetaBySelectorExpr(file *ast.File, fileSet *token.FileSet, packages []*packages.Package, ...) (definitions.TypeMetadata, error)
- func IsAliasDefault(fullPackageName string, alias string) bool
- func IsAliasDefaultImport(file *ast.File, alias string) bool
- func IsFuncDeclReceiverForStruct(structName string, funcDecl *ast.FuncDecl) bool
- func IsIdentFromDotImport(file *ast.File, ident *ast.Ident, typeInfo *types.Info) (bool, error)
- func IsIdentInPackage(pkg *packages.Package, ident *ast.Ident) bool
- func IsPackageDotImported(file *ast.File, packageName string) (bool, string)
- func IsUniverseType(typeName string) bool
- func MapDocListToStrings(docList []*ast.Comment) []string
- func SearchForParamTerm(lines []string, searchTerm string) string
- type ControllerVisitor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildRestMetadata ¶
func BuildRestMetadata(comments []string) definitions.RestMetadata
func DoesStructEmbedStruct ¶
func DoesStructEmbedStructByName ¶
func DoesStructEmbedStructByName(structNode *ast.StructType, embeddedStructName string) bool
DoesStructEmbedStructByName Checks whether `structNode` embeds a struct who's name equals embeddedStructName. Note this function does NOT take into account
func EmbedsBaseStruct ¶
func EmbedsBaseStruct(structType *ast.StructType, baseStruct string) bool
EmbedsBaseStruct checks if a struct embeds the specified base struct.
func ExtractClassMetadata ¶
func ExtractClassMetadata(d ast.GenDecl, baseStruct string) (*definitions.ControllerMetadata, error)
func ExtractClassRoutesMetaData ¶
func ExtractClassRoutesMetaData(routeFuncDecl ast.FuncDecl) (*definitions.RouteMetadata, error)
func ExtractFuncReturnTypes ¶
func ExtractFuncReturnTypes(d ast.FuncDecl) (string, definitions.FuncReturnSignature, error)
func ExtractMetadata ¶
func ExtractMetadata() ([]definitions.ControllerMetadata, error)
func ExtractParamTerm ¶
ExtractParamTerm extracts the term immediately after "// @" and trims surrounding spaces.
func ExtractParenthesesContent ¶
ExtractParenthesesContent extracts the text inside parentheses after the word immediately following "@" If no parentheses exist, it returns an empty string.
func FilterDecls ¶
FilterDecls filters a slice of ast.Decl using a custom type-checking function.
func FilterPackageByFullName ¶
func FindAndExtract ¶
func FindAndExtractArray ¶
func GetAllPackageFiles ¶
func GetCommentsFromIdent ¶
func GetDefaultAlias ¶
func GetFieldUsageType ¶
func GetFileByImportNode ¶
func GetFullPackageName ¶
func GetFuncReturnTypeList ¶
func GetMetadata ¶
func GetMetadata()
func GetResponseInterface ¶
func GetResponseInterface(file *ast.File, fileSet *token.FileSet, funcDecl ast.FuncDecl) definitions.ResponseMetadata
func GetTextAfterParenthesis ¶
GetTextAfterParenthesis extracts the text before the character '(' in a given string. If '(' is not present, it returns the original string.
func GetTextBeforeParenthesis ¶
GetTextBeforeParenthesis extracts the text before the character '(' in a given string.
func GetTypeMetaByIdent ¶
func GetTypeMetaBySelectorExpr ¶
func GetTypeMetaBySelectorExpr( file *ast.File, fileSet *token.FileSet, packages []*packages.Package, selector *ast.SelectorExpr, ) (definitions.TypeMetadata, error)
func IsAliasDefault ¶
func IsIdentFromDotImport ¶
IsIdentFromDotImport resolves whether an `*ast.Ident` refers to a type from a dot-imported package.
func IsPackageDotImported ¶
func IsUniverseType ¶
func MapDocListToStrings ¶
MapDocListToStrings converts a list of comment nodes (ast.Comment) to a string array
func SearchForParamTerm ¶
SearchForParamTerm searches for a term in a list of strings that comes immediately after "// @" with no space, and with space after it.
Types ¶
type ControllerVisitor ¶
type ControllerVisitor struct {
// contains filtered or unexported fields
}
func (*ControllerVisitor) GetFiles ¶
func (v *ControllerVisitor) GetFiles() []*ast.File
func (*ControllerVisitor) GetLastError ¶
func (v *ControllerVisitor) GetLastError() *error
func (*ControllerVisitor) Init ¶
func (v *ControllerVisitor) Init(sourceFileGlobs []string) error