Documentation
¶
Index ¶
- type BlackHoleResult
- type BoundaryRule
- type BoundaryViolation
- type CallChainLink
- type ClassEntity
- type CloneGroup
- type CycleResult
- type Database
- func (d *Database) Close()
- func (d *Database) CreateCalls(callerID, calleeID string) error
- func (d *Database) CreateContainsClassToEntity(classID, entityID, entityType string) error
- func (d *Database) CreateContainsFileToEntity(filePath, entityID, entityType string) error
- func (d *Database) CreateImplements(fromID, toID string) error
- func (d *Database) CreateImportsFileToEntity(fromPath, entityID, entityType string) error
- func (d *Database) CreateImportsFileToFile(fromPath, toPath string) error
- func (d *Database) DeleteFileEntities(filePath string) error
- func (d *Database) ExportGraph() ([]VisNode, []VisEdge, error)
- func (d *Database) FileExists(path string) (bool, error)
- func (d *Database) FindClassIDByName(name string) (string, error)
- func (d *Database) GetBlackHoles() ([]BlackHoleResult, error)
- func (d *Database) GetBoundaryViolations(rules []BoundaryRule) ([]BoundaryViolation, error)
- func (d *Database) GetCallChain(targetFunction string, depth int) ([]CallChainLink, error)
- func (d *Database) GetClones() ([]CloneGroup, error)
- func (d *Database) GetCycles() ([]CycleResult, error)
- func (d *Database) GetDeadCode() ([]DeadCodeResult, error)
- func (d *Database) GetDeepCallChains(minDepth int) ([]DeepCallChainResult, error)
- func (d *Database) GetDiffData() (*DiffData, error)
- func (d *Database) GetFileStructure(filePath string) ([]FileStructureItem, error)
- func (d *Database) GetFunctionRange(id string) (string, int64, int64, error)
- func (d *Database) GetGodObjects() ([]GodObjectResult, error)
- func (d *Database) GetStats() (int64, int64, int64, int64, error)
- func (d *Database) InsertClass(c ClassEntity) error
- func (d *Database) InsertFile(path, hash string, lastModified int64) error
- func (d *Database) InsertFunction(fn FunctionEntity) error
- func (d *Database) InsertVariable(v VariableEntity) error
- func (d *Database) IsEmpty() (bool, error)
- func (d *Database) IsReadOnly() bool
- func (d *Database) SearchCodebase(query string) ([]SearchResult, error)
- type DeadCodeResult
- type DeepCallChainResult
- type DiffData
- type FileEntity
- type FileStructureItem
- type FunctionEntity
- type GodObjectResult
- type SearchResult
- type VariableEntity
- type VisEdge
- type VisNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlackHoleResult ¶
type BoundaryRule ¶ added in v0.2.0
type BoundaryViolation ¶ added in v0.2.0
type CallChainLink ¶
type ClassEntity ¶
type CloneGroup ¶ added in v0.2.0
type CloneGroup struct {
ASTHash string `json:"ast_hash"`
Functions []SearchResult `json:"functions"`
}
type CycleResult ¶
type CycleResult struct {
FilePath string
}
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database wraps the Kùzu database instance and its connection.
func NewDatabase ¶
NewDatabase opens the Kùzu database at the specified path and runs DDL schema initialization.
func (*Database) CreateCalls ¶
CreateCalls creates a CALLS edge.
func (*Database) CreateContainsClassToEntity ¶
CreateContainsClassToEntity creates a CONTAINS edge from Class to Function/Variable.
func (*Database) CreateContainsFileToEntity ¶
CreateContainsFileToEntity creates a CONTAINS edge from File to Function/Class/Variable.
func (*Database) CreateImplements ¶
CreateImplements creates an IMPLEMENTS edge between Classes/Interfaces.
func (*Database) CreateImportsFileToEntity ¶
CreateImportsFileToEntity creates an IMPORTS edge from File to Class/Function/Variable.
func (*Database) CreateImportsFileToFile ¶
CreateImportsFileToFile creates an IMPORTS edge between files.
func (*Database) DeleteFileEntities ¶
DeleteFileEntities deletes all nodes and relationships associated with a file path (delta update).
func (*Database) FileExists ¶ added in v0.1.1
FileExists returns true if a File node with the given path exists in the database.
func (*Database) FindClassIDByName ¶
FindClassIDByName returns the ID of the first Class with the given name, or "" if not found.
func (*Database) GetBlackHoles ¶
func (d *Database) GetBlackHoles() ([]BlackHoleResult, error)
GetBlackHoles returns functions with high inbound dependencies (heavily called).
func (*Database) GetBoundaryViolations ¶ added in v0.2.0
func (d *Database) GetBoundaryViolations(rules []BoundaryRule) ([]BoundaryViolation, error)
GetBoundaryViolations identifies calls and imports that violate layer/module restrictions.
func (*Database) GetCallChain ¶
func (d *Database) GetCallChain(targetFunction string, depth int) ([]CallChainLink, error)
GetCallChain traces all upstream callers of the target function up to depth.
func (*Database) GetClones ¶ added in v0.2.0
func (d *Database) GetClones() ([]CloneGroup, error)
GetClones finds functions that have the exact same structural AST hash.
func (*Database) GetCycles ¶
func (d *Database) GetCycles() ([]CycleResult, error)
GetCycles detects cyclic dependencies (circular imports between files).
func (*Database) GetDeadCode ¶
func (d *Database) GetDeadCode() ([]DeadCodeResult, error)
GetDeadCode detects functions that are not called and are not exported.
func (*Database) GetDeepCallChains ¶ added in v0.2.0
func (d *Database) GetDeepCallChains(minDepth int) ([]DeepCallChainResult, error)
GetDeepCallChains returns call chains where caller invocations exceed minDepth (e.g., depth >= 4).
func (*Database) GetDiffData ¶ added in v0.2.0
GetDiffData returns all database data needed for diffing.
func (*Database) GetFileStructure ¶
func (d *Database) GetFileStructure(filePath string) ([]FileStructureItem, error)
GetFileStructure returns the hierarchical contents of a file.
func (*Database) GetFunctionRange ¶ added in v0.2.0
GetFunctionRange retrieves the file path, start line, and end line for a function by its ID.
func (*Database) GetGodObjects ¶
func (d *Database) GetGodObjects() ([]GodObjectResult, error)
GetGodObjects returns classes with high outbound complexity (contains many methods/variables).
func (*Database) GetStats ¶ added in v0.2.0
GetStats returns total function count, total class count, interface count, and concrete class count.
func (*Database) InsertClass ¶
func (d *Database) InsertClass(c ClassEntity) error
InsertClass inserts a class node.
func (*Database) InsertFile ¶
InsertFile inserts a file node.
func (*Database) InsertFunction ¶
func (d *Database) InsertFunction(fn FunctionEntity) error
InsertFunction inserts a function node.
func (*Database) InsertVariable ¶
func (d *Database) InsertVariable(v VariableEntity) error
InsertVariable inserts a variable node.
func (*Database) IsReadOnly ¶ added in v0.1.1
IsReadOnly returns true if the database was opened in read-only mode.
func (*Database) SearchCodebase ¶
func (d *Database) SearchCodebase(query string) ([]SearchResult, error)
SearchCodebase executes search over functions, classes, and variables.
type DeadCodeResult ¶
type DeepCallChainResult ¶ added in v0.2.0
type DiffData ¶ added in v0.2.0
type DiffData struct {
Files []FileEntity
Functions []FunctionEntity
Classes []ClassEntity
Variables []VariableEntity
ContainsRel map[string]string // maps child ID to parent class name
Edges []VisEdge
}
type FileEntity ¶ added in v0.2.0
type FileStructureItem ¶
type FunctionEntity ¶
type FunctionEntity struct {
ID string
Name string
FilePath string
StartLine int64
EndLine int64
Docstring string
IsExported bool
ASTHash string
}
Entity types for mapping in Go code