Documentation
¶
Index ¶
- Constants
- func DoesStructEmbedStruct(sourceFile *ast.File, structFullPackageName string, structNode *ast.StructType, ...) bool
- func DoesStructEmbedStructByName(structNode *ast.StructType, embeddedStructName string) bool
- func DoesStructEmbedType(pkg *packages.Package, structName string, embeddedStructFullPackage string, ...) (bool, error)
- func DoesTypeOrInterfaceExistInPackage(packages []*packages.Package, packageFullName string, ident *ast.Ident) (bool, bool)
- func FilterPackageByFullName(packages []*packages.Package, fullName string) *packages.Package
- func FindAndExtract(input []string, search string) string
- func FindAndExtractOccurrences(input []string, search string, maxMatchCount uint) []string
- func FindGenDeclByName(pkg *packages.Package, typeSpecName string) *ast.GenDecl
- func FindStructAst(pkg *packages.Package, structName string) *ast.StructType
- func FindTypesStructInPackage(pkg *packages.Package, structName string) (*types.Struct, error)
- func GetAllPackageFiles(codeFiles []*ast.File, fileSet *token.FileSet, fullPackageNameToFind string) ([]*ast.File, error)
- func GetCastProperty[TPropertyType any](attrib *Attribute, property string) (*TPropertyType, 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 GetFieldMetadata(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 GetFuncParameterTypeList(file *ast.File, fileSet *token.FileSet, packages []*packages.Package, ...) ([]definitions.ParamMeta, error)
- func GetFuncReturnTypeList(file *ast.File, fileSet *token.FileSet, packages []*packages.Package, ...) ([]definitions.TypeMetadata, error)
- func GetImportAliases(file *ast.File) map[string]string
- func GetPackageAndDependencies(codeFiles []*ast.File, fileSet *token.FileSet, fullPackageNameToFind string, ...) error
- func GetPackagesFromExpressions(packageExpressions []string) ([]*packages.Package, error)
- func GetStructFromGenDecl(decl *ast.GenDecl) *ast.StructType
- 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
- type Attribute
- type AttributesHolder
- func (holder AttributesHolder) FindByValueOrProperty(key string, value string) *Attribute
- func (holder AttributesHolder) FindFirstByProperty(key string, value string) *Attribute
- func (holder AttributesHolder) FindFirstByValue(value string) *Attribute
- func (holder AttributesHolder) GetAll(attribute string) []*Attribute
- func (holder AttributesHolder) GetDescription() string
- func (holder AttributesHolder) GetFirst(attribute string) *Attribute
- func (holder AttributesHolder) GetFirstDescriptionOrEmpty(attribute string) string
- func (holder AttributesHolder) GetFirstPropertyValueOrEmpty(property string) string
- func (holder AttributesHolder) GetFirstValueOrEmpty(attribute string) string
- func (holder AttributesHolder) Has(attribute string) bool
- type ControllerVisitor
- func (v ControllerVisitor) DumpContext() (string, error)
- func (v ControllerVisitor) GetControllers() []definitions.ControllerMetadata
- func (v *ControllerVisitor) GetFiles() []*ast.File
- func (v *ControllerVisitor) GetFormattedDiagnosticStack() string
- func (v *ControllerVisitor) GetLastError() *error
- func (v *ControllerVisitor) GetModelsFlat() ([]definitions.ModelMetadata, bool, error)
- func (v *ControllerVisitor) Visit(node ast.Node) ast.Visitor
- type Field
- type StructAttributeHolders
- type StructInfo
- type TypeVisitor
Constants ¶
View Source
const ( PropertyName = "name" PropertySecurityScopes = "scopes" PropertyValidatorString = "validate" )
View Source
const ( AttributeTag = "Tag" AttributeQuery = "Query" AttributeDeprecated = "Deprecated" AttributeHidden = "Hidden" AttributeSecurity = "Security" AttributeAdvancedSecurity = "AdvancedSecurity" AttributeRoute = "Route" AttributeResponse = "Response" AttributeDescription = "Description" AttributeMethod = "Method" AttributeErrorResponse = "ErrorResponse" )
Variables ¶
This section is empty.
Functions ¶
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 DoesStructEmbedType ¶
func FilterPackageByFullName ¶
func FindAndExtract ¶
func FindGenDeclByName ¶
func FindStructAst ¶
func FindStructAst(pkg *packages.Package, structName string) *ast.StructType
func GetAllPackageFiles ¶
func GetCastProperty ¶
func GetCommentsFromIdent ¶
func GetDefaultAlias ¶
func GetFieldMetadata ¶
func GetFileByImportNode ¶
func GetFullPackageName ¶
func GetFuncReturnTypeList ¶
func GetStructFromGenDecl ¶
func GetStructFromGenDecl(decl *ast.GenDecl) *ast.StructType
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
Types ¶
type AttributesHolder ¶
type AttributesHolder struct {
// contains filtered or unexported fields
}
func NewAttributeHolder ¶
func NewAttributeHolder(comments []string) (AttributesHolder, error)
func (AttributesHolder) FindByValueOrProperty ¶
func (holder AttributesHolder) FindByValueOrProperty(key string, value string) *Attribute
func (AttributesHolder) FindFirstByProperty ¶
func (holder AttributesHolder) FindFirstByProperty(key string, value string) *Attribute
func (AttributesHolder) FindFirstByValue ¶
func (holder AttributesHolder) FindFirstByValue(value string) *Attribute
func (AttributesHolder) GetAll ¶
func (holder AttributesHolder) GetAll(attribute string) []*Attribute
func (AttributesHolder) GetDescription ¶
func (holder AttributesHolder) GetDescription() string
func (AttributesHolder) GetFirst ¶
func (holder AttributesHolder) GetFirst(attribute string) *Attribute
func (AttributesHolder) GetFirstDescriptionOrEmpty ¶
func (holder AttributesHolder) GetFirstDescriptionOrEmpty(attribute string) string
func (AttributesHolder) GetFirstPropertyValueOrEmpty ¶
func (holder AttributesHolder) GetFirstPropertyValueOrEmpty(property string) string
func (AttributesHolder) GetFirstValueOrEmpty ¶
func (holder AttributesHolder) GetFirstValueOrEmpty(attribute string) string
func (AttributesHolder) Has ¶
func (holder AttributesHolder) Has(attribute string) bool
type ControllerVisitor ¶
type ControllerVisitor struct {
// contains filtered or unexported fields
}
func NewControllerVisitor ¶
func NewControllerVisitor(config *definitions.GleeceConfig) (*ControllerVisitor, error)
func (ControllerVisitor) DumpContext ¶
func (v ControllerVisitor) DumpContext() (string, error)
func (ControllerVisitor) GetControllers ¶
func (v ControllerVisitor) GetControllers() []definitions.ControllerMetadata
func (*ControllerVisitor) GetFiles ¶
func (v *ControllerVisitor) GetFiles() []*ast.File
func (*ControllerVisitor) GetFormattedDiagnosticStack ¶
func (v *ControllerVisitor) GetFormattedDiagnosticStack() string
func (*ControllerVisitor) GetLastError ¶
func (v *ControllerVisitor) GetLastError() *error
func (*ControllerVisitor) GetModelsFlat ¶
func (v *ControllerVisitor) GetModelsFlat() ([]definitions.ModelMetadata, bool, error)
type StructAttributeHolders ¶
type StructAttributeHolders struct { StructHolder AttributesHolder FieldHolders map[string]*AttributesHolder }
type StructInfo ¶
StructInfo represents a struct with its fields
type TypeVisitor ¶
type TypeVisitor struct {
// contains filtered or unexported fields
}
func NewTypeVisitor ¶
func NewTypeVisitor(packages []*packages.Package) *TypeVisitor
func (*TypeVisitor) GetStructs ¶
func (v *TypeVisitor) GetStructs() []definitions.ModelMetadata
GetStructs returns the list of processed structs.
func (*TypeVisitor) VisitStruct ¶
Click to show internal directories.
Click to hide internal directories.