Documentation
¶
Index ¶
- func Now() string
- type Edge
- type EdgeInfo
- type FileHash
- type LabelCount
- type Node
- type NodeHop
- type Project
- type SchemaInfo
- type SearchParams
- type SearchResult
- type Store
- func (s *Store) AllNodes(project string) ([]*Node, error)
- func (s *Store) BFS(startNodeID int64, direction string, edgeTypes []string, ...) (*TraverseResult, error)
- func (s *Store) Close() error
- func (s *Store) CountEdges(project string) (int, error)
- func (s *Store) CountNodes(project string) (int, error)
- func (s *Store) DB() *sql.DB
- func (s *Store) DeleteEdgesByProject(project string) error
- func (s *Store) DeleteEdgesByType(project, edgeType string) error
- func (s *Store) DeleteFileHash(project, relPath string) error
- func (s *Store) DeleteFileHashes(project string) error
- func (s *Store) DeleteNodesByFile(project, filePath string) error
- func (s *Store) DeleteNodesByLabel(project, label string) error
- func (s *Store) DeleteNodesByProject(project string) error
- func (s *Store) DeleteProject(name string) error
- func (s *Store) FindEdgesBySource(sourceID int64) ([]*Edge, error)
- func (s *Store) FindEdgesBySourceAndType(sourceID int64, edgeType string) ([]*Edge, error)
- func (s *Store) FindEdgesByTarget(targetID int64) ([]*Edge, error)
- func (s *Store) FindEdgesByTargetAndType(targetID int64, edgeType string) ([]*Edge, error)
- func (s *Store) FindNodeByID(id int64) (*Node, error)
- func (s *Store) FindNodeByQN(project, qualifiedName string) (*Node, error)
- func (s *Store) FindNodesByFile(project, filePath string) ([]*Node, error)
- func (s *Store) FindNodesByLabel(project, label string) ([]*Node, error)
- func (s *Store) FindNodesByName(project, name string) ([]*Node, error)
- func (s *Store) GetFileHashes(project string) (map[string]string, error)
- func (s *Store) GetProject(name string) (*Project, error)
- func (s *Store) GetSchema(project string) (*SchemaInfo, error)
- func (s *Store) InsertEdge(e *Edge) (int64, error)
- func (s *Store) ListProjects() ([]*Project, error)
- func (s *Store) Search(params SearchParams) ([]*SearchResult, error)
- func (s *Store) UpsertFileHash(project, relPath, sha256 string) error
- func (s *Store) UpsertNode(n *Node) (int64, error)
- func (s *Store) UpsertProject(name, rootPath string) error
- type TraverseResult
- type TypeCount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Edge ¶
type Edge struct {
ID int64
Project string
SourceID int64
TargetID int64
Type string
Properties map[string]any
}
Edge represents a graph edge stored in SQLite.
type LabelCount ¶
LabelCount is a label with its count.
type Node ¶
type Node struct {
ID int64
Project string
Label string
Name string
QualifiedName string
FilePath string
StartLine int
EndLine int
Properties map[string]any
}
Node represents a graph node stored in SQLite.
type SchemaInfo ¶
type SchemaInfo struct {
NodeLabels []LabelCount `json:"node_labels"`
RelationshipTypes []TypeCount `json:"relationship_types"`
RelationshipPatterns []string `json:"relationship_patterns"`
SampleFunctionNames []string `json:"sample_function_names"`
SampleClassNames []string `json:"sample_class_names"`
SampleQualifiedNames []string `json:"sample_qualified_names"`
}
SchemaInfo contains graph schema statistics.
type SearchParams ¶
type SearchParams struct {
Project string
Label string
NamePattern string
FilePattern string
Relationship string
Direction string // "inbound", "outbound", "any"
MinDegree int
MaxDegree int
Limit int
ExcludeEntryPoints bool // when true, exclude nodes with is_entry_point=true
}
SearchParams defines structured search parameters.
type SearchResult ¶
SearchResult is a node with edge degree info.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store wraps a SQLite connection for graph storage.
func OpenMemory ¶
OpenMemory opens an in-memory SQLite database (for testing).
func (*Store) BFS ¶
func (s *Store) BFS(startNodeID int64, direction string, edgeTypes []string, maxDepth, maxResults int) (*TraverseResult, error)
BFS performs breadth-first traversal following edges of given types. direction: "outbound" follows source->target, "inbound" follows target->source. maxDepth caps the BFS depth, maxResults caps total visited nodes.
func (*Store) CountEdges ¶
CountEdges returns the number of edges in a project.
func (*Store) CountNodes ¶
CountNodes returns the number of nodes in a project.
func (*Store) DeleteEdgesByProject ¶
DeleteEdgesByProject deletes all edges for a project.
func (*Store) DeleteEdgesByType ¶
DeleteEdgesByType deletes all edges of a given type for a project.
func (*Store) DeleteFileHash ¶
DeleteFileHash deletes a single file hash entry.
func (*Store) DeleteFileHashes ¶
DeleteFileHashes deletes all file hashes for a project.
func (*Store) DeleteNodesByFile ¶
DeleteNodesByFile deletes all nodes for a specific file in a project.
func (*Store) DeleteNodesByLabel ¶
DeleteNodesByLabel deletes all nodes with a given label in a project.
func (*Store) DeleteNodesByProject ¶
DeleteNodesByProject deletes all nodes for a project.
func (*Store) DeleteProject ¶
DeleteProject deletes a project and all associated data (CASCADE).
func (*Store) FindEdgesBySource ¶
FindEdgesBySource finds all edges from a given source node.
func (*Store) FindEdgesBySourceAndType ¶
FindEdgesBySourceAndType finds edges from a source with a specific type.
func (*Store) FindEdgesByTarget ¶
FindEdgesByTarget finds all edges to a given target node.
func (*Store) FindEdgesByTargetAndType ¶
FindEdgesByTargetAndType finds edges to a target with a specific type.
func (*Store) FindNodeByID ¶
FindNodeByID finds a node by its primary key ID.
func (*Store) FindNodeByQN ¶
FindNodeByQN finds a node by project and qualified name.
func (*Store) FindNodesByFile ¶
FindNodesByFile finds all nodes in a given file.
func (*Store) FindNodesByLabel ¶
FindNodesByLabel finds all nodes with a given label in a project.
func (*Store) FindNodesByName ¶
FindNodesByName finds nodes by project and name.
func (*Store) GetFileHashes ¶
GetFileHashes returns all file hashes for a project.
func (*Store) GetProject ¶
GetProject returns a project by name.
func (*Store) GetSchema ¶
func (s *Store) GetSchema(project string) (*SchemaInfo, error)
GetSchema returns graph schema statistics for a project.
func (*Store) InsertEdge ¶
InsertEdge inserts an edge (dedup by source_id, target_id, type).
func (*Store) ListProjects ¶
ListProjects returns all indexed projects.
func (*Store) Search ¶
func (s *Store) Search(params SearchParams) ([]*SearchResult, error)
Search executes a parameterized search query.
func (*Store) UpsertFileHash ¶
UpsertFileHash stores a file's content hash.
func (*Store) UpsertNode ¶
UpsertNode inserts or replaces a node (dedup by qualified_name).
func (*Store) UpsertProject ¶
UpsertProject creates or updates a project record.
type TraverseResult ¶
TraverseResult holds BFS traversal results.