Documentation
¶
Index ¶
- type ASTScanner
- type FileFilter
- type HandlerFunction
- type HandlerImplementation
- type HandlerInterface
- type ProviderFunction
- type RouteMapping
- type ScanError
- type ScanResult
- type ScanStatistics
- type Scanner
- func (s *Scanner) GetStatistics(result *ScanResult) ScanStatistics
- func (s *Scanner) ScanAll() (*ScanResult, error)
- func (s *Scanner) ScanDirectory(directory string) (*ScanResult, error)
- func (s *Scanner) ScanProviders(directories []string) ([]ProviderFunction, error)
- func (s *Scanner) ScanRoutes(directories []string) ([]HandlerFunction, []RouteMapping, error)
- type ValidationError
- type ValidationResult
- type ValidationWarning
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ASTScanner ¶
type ASTScanner struct {
// contains filtered or unexported fields
}
ASTScanner uses Go's AST parser for accurate code analysis
func (*ASTScanner) ScanFile ¶
func (s *ASTScanner) ScanFile(filePath string) (*ScanResult, error)
ScanFile parses a Go file and extracts handlers, routes, and providers
type FileFilter ¶
type FileFilter struct {
// contains filtered or unexported fields
}
FileFilter handles filtering of Go files based on .taskwignore patterns
func NewFileFilter ¶
func NewFileFilter() *FileFilter
NewFileFilter creates a new file filter and loads .taskwignore patterns
func (*FileFilter) CreateDefaultTaskwIgnore ¶
func (f *FileFilter) CreateDefaultTaskwIgnore() error
CreateDefaultTaskwIgnore creates a default .taskwignore file
func (*FileFilter) FindCandidateFiles ¶
func (f *FileFilter) FindCandidateFiles(rootDir string) ([]string, error)
FindCandidateFiles recursively finds all Go files that are not ignored
type HandlerFunction ¶
type HandlerFunction struct {
FunctionName string // e.g., "GetUser"
Package string // e.g., "user"
HandlerName string // e.g., "UserHandler" (interface name if using interface pattern)
ImplementerName string // e.g., "HandlerImpl" (only for interface pattern)
ReturnType string // Always "error" for Fiber handlers
FilePath string // Path to the file containing this handler
IsInterfaceBased bool // true if this handler uses interface + implementation pattern
}
HandlerFunction represents a Fiber handler function found in the codebase
type HandlerImplementation ¶ added in v1.0.4
type HandlerImplementation struct {
StructName string // e.g., "HandlerImpl"
Package string // e.g., "user"
InterfaceName string // e.g., "Handler" (the interface it implements)
Methods []string // e.g., ["GetUser", "CreateUser"]
FilePath string // Path to the file containing this struct
}
HandlerImplementation represents a handler implementation struct
type HandlerInterface ¶ added in v1.0.4
type HandlerInterface struct {
InterfaceName string // e.g., "Handler"
Package string // e.g., "user"
Methods []string // e.g., ["GetUser", "CreateUser"]
FilePath string // Path to the file containing this interface
}
HandlerInterface represents a handler interface definition
type ProviderFunction ¶
type ProviderFunction struct {
FunctionName string // e.g., "ProvideUserService"
Package string // e.g., "user"
ReturnType string // e.g., "*UserService"
Parameters []string // Parameter types for dependency resolution
FilePath string // Path to the file containing this provider
}
ProviderFunction represents a Wire provider function
type RouteMapping ¶
type RouteMapping struct {
MethodName string // e.g., "GetUser"
Path string // e.g., "/users/:id"
HTTPMethod string // e.g., "GET", "POST", "PUT", "DELETE"
HandlerRef string // e.g., "userHandler.GetUser"
Package string // Package name for import resolution
}
RouteMapping represents a @Router annotation mapping
type ScanError ¶
type ScanError struct {
FilePath string
Line int
Message string
Type string // "handler", "route", "provider"
}
ScanError represents an error encountered during scanning
type ScanResult ¶
type ScanResult struct {
Handlers []HandlerFunction
Routes []RouteMapping
Providers []ProviderFunction
Interfaces []HandlerInterface // Handler interfaces found
Implementations []HandlerImplementation // Handler implementations found
Errors []ScanError
}
ScanResult aggregates all scanning results
type ScanStatistics ¶
type ScanStatistics struct {
HandlersFound int
RoutesFound int
ProvidersFound int
ErrorsFound int
PackagesScanned int
}
ScanStatistics provides information about scanning results
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner is the main hybrid scanner that combines file filtering with AST parsing
func NewScanner ¶
NewScanner creates a new hybrid scanner instance
func (*Scanner) GetStatistics ¶
func (s *Scanner) GetStatistics(result *ScanResult) ScanStatistics
GetStatistics returns scanning statistics for debugging
func (*Scanner) ScanAll ¶
func (s *Scanner) ScanAll() (*ScanResult, error)
ScanAll scans all configured directories for handlers, routes, and providers
func (*Scanner) ScanDirectory ¶
func (s *Scanner) ScanDirectory(directory string) (*ScanResult, error)
ScanDirectory scans a single directory using the hybrid approach
func (*Scanner) ScanProviders ¶
func (s *Scanner) ScanProviders(directories []string) ([]ProviderFunction, error)
ScanProviders specifically scans for provider functions
func (*Scanner) ScanRoutes ¶
func (s *Scanner) ScanRoutes(directories []string) ([]HandlerFunction, []RouteMapping, error)
ScanRoutes specifically scans for handlers and routes (for backwards compatibility)
type ValidationError ¶
type ValidationError struct {
Type string // "duplicate_route", "invalid_signature", etc.
Message string
FilePath string
Line int
Handler *HandlerFunction
Route *RouteMapping
}
ValidationError represents a validation error that prevents code generation
type ValidationResult ¶
type ValidationResult struct {
Errors []ValidationError
Warnings []ValidationWarning
}
ValidationResult contains validation errors and warnings
func (*ValidationResult) HasErrors ¶
func (vr *ValidationResult) HasErrors() bool
HasErrors returns true if there are validation errors
func (*ValidationResult) HasWarnings ¶
func (vr *ValidationResult) HasWarnings() bool
HasWarnings returns true if there are validation warnings
type ValidationWarning ¶
type ValidationWarning struct {
Type string
Message string
FilePath string
Handler *HandlerFunction
}
ValidationWarning represents a validation warning that might cause issues
type Validator ¶
type Validator struct{}
Validator validates scan results for common issues
func (*Validator) ValidateScanResult ¶
func (v *Validator) ValidateScanResult(result *ScanResult) *ValidationResult
ValidateScanResult validates handlers, routes, and providers for common issues