Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ScanLine ¶
func ScanLine(line string) []tableMatch
ScanLine extracts table references from a single line of code.
func ScanLineColumns ¶
func ScanLineColumns(line string) []columnMatch
ScanLineColumns extracts column references from a single line of code.
Types ¶
type ColumnRef ¶
type ColumnRef struct {
Table string `json:"table"`
Column string `json:"column"`
Schema string `json:"schema,omitempty"`
File string `json:"file"`
Line int `json:"line"`
Context Context `json:"context"`
Suppressed bool `json:"suppressed,omitempty"`
}
ColumnRef is a single reference to a database column found in code.
type PatternType ¶
type PatternType string
PatternType identifies how a table reference was detected.
const ( PatternSQL PatternType = "sql" PatternORM PatternType = "orm" PatternMigration PatternType = "migration" )
type ScanResult ¶
type ScanResult struct {
RepoPath string `json:"repoPath"`
Refs []TableRef `json:"refs"`
ColumnRefs []ColumnRef `json:"columnRefs,omitempty"`
Tables []string `json:"tables"`
Columns []string `json:"columns,omitempty"`
FilesScanned int `json:"filesScanned"`
FilesSkipped int `json:"filesSkipped,omitempty"`
}
ScanResult holds all table and column references found in a code repository.
func Scan ¶
func Scan(repoPath string) (ScanResult, error)
Scan walks a code repository and extracts SQL table references.
func ScanParallel ¶
func ScanParallel(repoPath string, workers int) (ScanResult, error)
ScanParallel walks a code repository using N goroutines. workers=0 means runtime.NumCPU(). workers=1 is sequential.
type TableRef ¶
type TableRef struct {
Table string `json:"table"`
Schema string `json:"schema,omitempty"`
File string `json:"file"`
Line int `json:"line"`
Pattern PatternType `json:"pattern"`
Context Context `json:"context"`
Suppressed bool `json:"suppressed,omitempty"`
}
TableRef is a single reference to a database table found in code.
Click to show internal directories.
Click to hide internal directories.