Documentation
¶
Overview ¶
@index GORM persistence adapter for git-diff change-risk analysis.
@index GORM read adapter for documentation generation and lint facts.
@index GORM persistence adapter for atomic stored-flow rebuilds.
@index GORM persistence adapter for predefined analysis graph queries.
@index GORM read models for MCP graph, context, namespace, and change surfaces.
@index GORM graph statistics adapter for operator and protocol read surfaces.
@index GORM-based graph repository that manages CRUD operations and transactions for nodes, edges, and annotations.
@index GORM unit-of-work adapter for atomic graph and derived search updates.
@index GORM read adapter for eager and lazy built-in Wiki tree construction.
Index ¶
- type SearchWriterFactory
- type Store
- func (s *Store) AffectedFlowsPage(ctx context.Context, changedNodeIDs []uint, limit, offset int) ([]analyze.AffectedFlow, bool, error)
- func (s *Store) Annotations(ctx context.Context, ids []uint) (map[uint]*graph.Annotation, error)
- func (s *Store) AutoMigrate() error
- func (s *Store) CCGRefExists(ctx context.Context, ref reference.Ref) (bool, error)
- func (s *Store) CallEdges(ctx context.Context, anchorID uint, peerIDs []uint, ...) (map[uint]graph.Edge, error)
- func (s *Store) CreateFlow(ctx context.Context, flow *graph.Flow) error
- func (s *Store) DeleteEdgesByFile(ctx context.Context, filePath string) error
- func (s *Store) DeleteFlows(ctx context.Context) error
- func (s *Store) DeleteGraph(ctx context.Context) error
- func (s *Store) DeleteNodesByFile(ctx context.Context, filePath string) error
- func (s *Store) DeletePackageSemanticEdges(ctx context.Context, anchors []string) error
- func (s *Store) FileSymbols(ctx context.Context, filePath string, kinds []graph.NodeKind) ([]graph.Node, error)
- func (s *Store) FindFlowEntrypoints(ctx context.Context) ([]graph.Node, error)
- func (s *Store) FlowsPage(ctx context.Context, sortBy string, limit, offset int) ([]analyze.FlowSummary, bool, error)
- func (s *Store) GetAnnotation(ctx context.Context, nodeID uint) (*graph.Annotation, error)
- func (s *Store) GetEdgesFrom(ctx context.Context, nodeID uint) ([]graph.Edge, error)
- func (s *Store) GetEdgesFromNodes(ctx context.Context, nodeIDs []uint) ([]graph.Edge, error)
- func (s *Store) GetEdgesTo(ctx context.Context, nodeID uint) ([]graph.Edge, error)
- func (s *Store) GetEdgesToNodes(ctx context.Context, nodeIDs []uint) ([]graph.Edge, error)
- func (s *Store) GetFileNodesByPathSuffix(ctx context.Context, suffix string) ([]graph.Node, error)
- func (s *Store) GetNode(ctx context.Context, qualifiedName string) (*graph.Node, error)
- func (s *Store) GetNodeByID(ctx context.Context, id uint) (*graph.Node, error)
- func (s *Store) GetNodesByFile(ctx context.Context, filePath string) ([]graph.Node, error)
- func (s *Store) GetNodesByFiles(ctx context.Context, filePaths []string) (map[string][]graph.Node, error)
- func (s *Store) GetNodesByIDs(ctx context.Context, ids []uint) ([]graph.Node, error)
- func (s *Store) GetNodesByQualifiedNames(ctx context.Context, names []string) (map[string][]graph.Node, error)
- func (s *Store) GraphStatistics(ctx context.Context) (analyze.GraphStatistics, error)
- func (s *Store) GraphView(ctx context.Context, limit int, edgeKinds []graph.EdgeKind) (wiki.GraphView, error)
- func (s *Store) HasSymbol(ctx context.Context, filePath string, kinds []graph.NodeKind) (bool, error)
- func (s *Store) ListFileNodes(ctx context.Context) ([]graph.Node, error)
- func (s *Store) Namespaces(ctx context.Context) ([]string, error)
- func (s *Store) NamespacesPage(ctx context.Context, limit, offset int) ([]analyze.NamespaceSummary, bool, error)
- func (s *Store) NavigationNodes(ctx context.Context, kinds []graph.NodeKind) ([]graph.Node, error)
- func (s *Store) NodesByExactName(ctx context.Context, name string, limit int) ([]graph.Node, error)
- func (s *Store) NodesByFile(ctx context.Context, filePath string) ([]graph.Node, error)
- func (s *Store) NodesByFiles(ctx context.Context, filePaths []string) ([]graph.Node, error)
- func (s *Store) OutgoingDocEdges(ctx context.Context, namespace string, ids []uint) (map[uint][]graph.Edge, error)
- func (s *Store) OutgoingEdgeCounts(ctx context.Context, nodeIDs []uint) (map[uint]int64, error)
- func (s *Store) PathNodes(ctx context.Context, folderPath string, kinds []graph.NodeKind) ([]graph.Node, error)
- func (s *Store) QualifiedNameExists(ctx context.Context, namespace, name string) (bool, error)
- func (s *Store) RelatedNodes(ctx context.Context, request analyzeapp.RelatedNodesRequest) (analyzeapp.RelatedNodesPage, error)
- func (s *Store) ResolveReference(ctx context.Context, ref *reference.Ref) (*graph.Node, error)
- func (s *Store) Snapshot(ctx context.Context, namespace string, kinds []graph.NodeKind) (docsapp.Snapshot, error)
- func (s *Store) StoredNode(ctx context.Context, kind graph.NodeKind, filePath string) (*graph.Node, error)
- func (s *Store) SymbolNode(ctx context.Context, qualifiedName string, kinds []graph.NodeKind) (*graph.Node, error)
- func (s *Store) TopCommunities(ctx context.Context, limit int) ([]analyze.NamedCount, error)
- func (s *Store) TopFlows(ctx context.Context, limit int) ([]analyze.NamedCount, error)
- func (s *Store) UntestedCount(ctx context.Context, nodeIDs []uint) (int, error)
- func (s *Store) UpsertAnnotation(ctx context.Context, ann *graph.Annotation) error
- func (s *Store) UpsertEdges(ctx context.Context, edges []graph.Edge) error
- func (s *Store) UpsertNodes(ctx context.Context, nodes []graph.Node) error
- func (s *Store) WithTx(ctx context.Context, fn func(store ingest.GraphStore) error) error
- func (s *Store) WithTxDB(ctx context.Context, fn func(ingest.GraphStore, *gorm.DB) error) error
- func (s *Store) WithinFlowRebuild(ctx context.Context, fn func(analyzeapp.FlowRebuildStore) error) error
- type UnitOfWork
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SearchWriterFactory ¶
type SearchWriterFactory func(tx *gorm.DB) ingest.SearchWriter
SearchWriterFactory binds a search writer to the active GORM transaction. @intent construct derived-state persistence with the same transaction handle as graph persistence.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the GORM-backed GraphStore implementation. @intent implement the graph repository contract through a GORM DB handle.
func New ¶
New creates a repository wrapping a GORM DB. @intent initialize the GraphStore implementation with the injected DB handle.
func (*Store) AffectedFlowsPage ¶
func (s *Store) AffectedFlowsPage(ctx context.Context, changedNodeIDs []uint, limit, offset int) ([]analyze.AffectedFlow, bool, error)
@intent map changed nodes to one deterministic page of namespace-scoped stored flows.
func (*Store) Annotations ¶
@intent batch-load Wiki annotations with deterministic tag ordering.
func (*Store) AutoMigrate ¶
AutoMigrate creates or updates the graph repository schema. @intent prepare the GORM model tables required for graph persistence. @sideEffect may modify the database schema.
func (*Store) CCGRefExists ¶
@intent validate parsed cross-namespace ccg references against graph path and symbol semantics.
func (*Store) CallEdges ¶
func (s *Store) CallEdges(ctx context.Context, anchorID uint, peerIDs []uint, direction analyze.EdgeDirection) (map[uint]graph.Edge, error)
@intent select the strongest call evidence edge for each requested peer node.
func (*Store) CreateFlow ¶
CreateFlow persists one flow and its ordered memberships through the active transaction. @intent store traced flow aggregates while keeping generated IDs visible to application results. @sideEffect inserts a flow row and zero or more flow-membership rows. @mutates flow.ID and each flow.Members item FlowID.
func (*Store) DeleteEdgesByFile ¶
DeleteEdgesByFile removes edges generated from a file. @intent selectively clean existing relationships during file-scoped updates. @sideEffect deletes matching file_path records from the edges table.
func (*Store) DeleteFlows ¶
DeleteFlows removes all stored flows and memberships in the active namespace. @intent clear stale flow state before a transaction-scoped rebuild. @sideEffect deletes namespace-owned flow and flow-membership rows.
func (*Store) DeleteGraph ¶
DeleteGraph removes the entire graph state for the current namespace. @intent replace namespace-scoped state before a full rebuild or include_paths rebuild. @sideEffect deletes all nodes, edges, annotations, and doc_tags in the namespace.
func (*Store) DeleteNodesByFile ¶
DeleteNodesByFile removes nodes in a file and their related data. @intent clean out prior nodes, edges, and annotations before reparsing a file. @sideEffect deletes related records from the nodes, edges, annotations, and doc_tags tables. @domainRule connected edges and annotations must also be removed when deleting a file.
func (*Store) DeletePackageSemanticEdges ¶
DeletePackageSemanticEdges removes synthesized package-level implementation edges for anchor files. @intent replace stale package semantic relationships without exposing persistence queries to the application layer. @sideEffect deletes namespace-scoped edge rows matching the supplied anchors. @domainRule only synthesized implements edges, identified by line zero, are eligible for deletion.
func (*Store) FileSymbols ¶
func (s *Store) FileSymbols(ctx context.Context, filePath string, kinds []graph.NodeKind) ([]graph.Node, error)
@intent load stable symbol children for one lazy Wiki file node.
func (*Store) FindFlowEntrypoints ¶
FindFlowEntrypoints returns function/test nodes with no inbound call-kind edge. @intent provide deterministic namespace-scoped entrypoints for stored-flow rebuild policy. @domainRule inbound detection includes every kind returned by graph.CallEdgeKinds.
func (*Store) FlowsPage ¶
func (s *Store) FlowsPage(ctx context.Context, sortBy string, limit, offset int) ([]analyze.FlowSummary, bool, error)
@intent load one stable namespace-scoped stored-flow page with member counts.
func (*Store) GetAnnotation ¶
GetAnnotation retrieves the annotation attached to a node ID. @intent load a node's structured comment and tags together for search and display. @return returns nil when no annotation exists.
func (*Store) GetEdgesFrom ¶
GetEdgesFrom retrieves outgoing edges from a node. @intent load outbound relationships for a specific declaration.
func (*Store) GetEdgesFromNodes ¶
GetEdgesFromNodes retrieves outgoing edges from multiple nodes. @intent load outbound relationships for multiple declarations in one call. @return returns a nil slice when nodeIDs is empty.
func (*Store) GetEdgesTo ¶
GetEdgesTo retrieves incoming edges to a node. @intent load inbound relationships for a specific declaration.
func (*Store) GetEdgesToNodes ¶
GetEdgesToNodes retrieves incoming edges to multiple nodes. @intent load inbound relationships for multiple declarations in one call. @return returns a nil slice when nodeIDs is empty.
func (*Store) GetFileNodesByPathSuffix ¶
GetFileNodesByPathSuffix finds file nodes whose directory matches an import-path suffix. @intent let import edge resolution bind repo-local import paths back to stored file nodes.
func (*Store) GetNode ¶
GetNode retrieves a single node by qualified name. @intent find one node by the declaration's qualified name. @return returns nil when no node exists.
func (*Store) GetNodeByID ¶
GetNodeByID retrieves a single node by primary key. @intent find one node by its internal identifier. @return returns nil when no node exists.
func (*Store) GetNodesByFile ¶
GetNodesByFile retrieves nodes belonging to a file path. @intent load declarations parsed from a specific source file.
func (*Store) GetNodesByFiles ¶
func (s *Store) GetNodesByFiles(ctx context.Context, filePaths []string) (map[string][]graph.Node, error)
GetNodesByFiles retrieves nodes from multiple files grouped by file path. @intent return declarations for a file set grouped by path. @return returns a map whose keys are file paths and values are the nodes in each file.
func (*Store) GetNodesByIDs ¶
GetNodesByIDs retrieves nodes matching the provided ID list. @intent load multiple nodes at once by internal identifier. @return returns a nil slice when ids is empty.
func (*Store) GetNodesByQualifiedNames ¶
func (s *Store) GetNodesByQualifiedNames(ctx context.Context, names []string) (map[string][]graph.Node, error)
GetNodesByQualifiedNames loads a set of names into a node map. @intent build a fast lookup map for qualified-name-based reference resolution. @return returns a map keyed by QualifiedName, with slices containing all nodes for each name.
func (*Store) GraphStatistics ¶
GraphStatistics loads totals and grouped distributions for the active namespace. @intent implement the application statistics port while preserving namespace filtering and aggregate semantics.
func (*Store) GraphView ¶
func (s *Store) GraphView(ctx context.Context, limit int, edgeKinds []graph.EdgeKind) (wiki.GraphView, error)
GraphView loads a bounded stable node set and only edges contained within it. @intent implement the Wiki force-graph read port with deterministic ordering and limits.
func (*Store) HasSymbol ¶
func (s *Store) HasSymbol(ctx context.Context, filePath string, kinds []graph.NodeKind) (bool, error)
@intent answer whether a lazy file node has expandable symbol children.
func (*Store) ListFileNodes ¶
ListFileNodes returns the minimal persisted state used to compare source files during an update. @intent expose namespace-scoped file identity and hash state without leaking the database handle.
func (*Store) Namespaces ¶
Namespaces returns distinct stored namespaces in stable order. @intent implement Wiki namespace discovery without exposing persistence to HTTP.
func (*Store) NamespacesPage ¶
func (s *Store) NamespacesPage(ctx context.Context, limit, offset int) ([]analyze.NamespaceSummary, bool, error)
@intent load one stable global namespace page with node counts.
func (*Store) NavigationNodes ¶
@intent load the stable graph snapshot from which the eager Wiki hierarchy is derived.
func (*Store) NodesByExactName ¶
NodesByExactName loads deterministic namespace-scoped short-name matches. @intent support exact-name fallback suggestions through the analysis repository.
func (*Store) NodesByFile ¶
NodesByFile loads all namespace-scoped nodes belonging to one file. @intent supply file-summary inputs without exposing database filtering to app policy.
func (*Store) NodesByFiles ¶
NodesByFiles loads deterministic namespace-scoped graph nodes for changed files. @intent supply diff-overlap inputs without exposing database filters to change policy.
func (*Store) OutgoingDocEdges ¶
func (s *Store) OutgoingDocEdges(ctx context.Context, namespace string, ids []uint) (map[uint][]graph.Edge, error)
@intent load call/import relationships rendered beneath symbol documentation.
func (*Store) OutgoingEdgeCounts ¶
OutgoingEdgeCounts returns namespace-scoped outgoing edge counts keyed by source node ID. @intent provide risk-weight inputs through one grouped persistence query.
func (*Store) PathNodes ¶
func (s *Store) PathNodes(ctx context.Context, folderPath string, kinds []graph.NodeKind) ([]graph.Node, error)
@intent load stable path-bearing candidates below one lazy Wiki folder or package.
func (*Store) QualifiedNameExists ¶
@intent validate local @see targets within the active docs namespace.
func (*Store) RelatedNodes ¶
func (s *Store) RelatedNodes(ctx context.Context, request analyzeapp.RelatedNodesRequest) (analyzeapp.RelatedNodesPage, error)
RelatedNodes loads one deterministic distinct relationship page and its total count. @intent implement namespace-scoped relationship joins behind the analysis query repository.
func (*Store) ResolveReference ¶
ResolveReference finds the first deterministic graph node matching a parsed CCG reference. @intent resolve Wiki reference navigation while keeping GORM filtering and preload behavior in the outbound adapter.
func (*Store) Snapshot ¶
func (s *Store) Snapshot(ctx context.Context, namespace string, kinds []graph.NodeKind) (docsapp.Snapshot, error)
@intent load documentable nodes and their annotations from one namespace.
func (*Store) StoredNode ¶
func (s *Store) StoredNode(ctx context.Context, kind graph.NodeKind, filePath string) (*graph.Node, error)
@intent resolve one stored package or file used as a lazy Wiki root.
func (*Store) SymbolNode ¶
func (s *Store) SymbolNode(ctx context.Context, qualifiedName string, kinds []graph.NodeKind) (*graph.Node, error)
@intent resolve the first deterministic symbol match used by direct lazy navigation.
func (*Store) TopCommunities ¶
@intent rank namespace communities by stored membership count.
func (*Store) UntestedCount ¶
@intent count requested nodes without a namespace-scoped tested_by edge.
func (*Store) UpsertAnnotation ¶
UpsertAnnotation stores a node's annotation and tags. @intent replace structured comments for each node with the latest state. @sideEffect performs inserts, updates, and deletes on the annotations and doc_tags tables. @mutates may overwrite ann.ID with the existing record ID. @domainRule only one annotation must be kept per node_id.
func (*Store) UpsertEdges ¶
UpsertEdges stores a batch of edges keyed by fingerprint. @intent apply graph relationships in bulk without duplicates. @sideEffect performs batch inserts on the edges table. @domainRule edges with the same fingerprint must be stored only once.
func (*Store) UpsertNodes ¶
UpsertNodes stores a batch of nodes keyed by qualified_name. @intent apply parsed result nodes in bulk without creating duplicates. @sideEffect performs batch inserts and updates on the nodes table. @requires nodes must have a non-empty QualifiedName. @ensures existing nodes with the same qualified_name are updated with the latest metadata.
func (*Store) WithTx ¶
WithTx executes the given function inside the same transaction. @intent allow multiple repository operations to run atomically as one unit. @sideEffect starts a database transaction and commits or rolls it back. @ensures commits the transaction when fn returns a nil error.
func (*Store) WithTxDB ¶
WithTxDB passes the transaction DB handle together with the repository. @intent let graph persistence and DB-backed derived-state updates share a single transaction. @sideEffect starts a database transaction and commits or rolls it back.
func (*Store) WithinFlowRebuild ¶
func (s *Store) WithinFlowRebuild(ctx context.Context, fn func(analyzeapp.FlowRebuildStore) error) error
WithinFlowRebuild executes stored-flow replacement against one transaction-scoped store. @intent implement the analysis flow unit of work without exposing GORM to application policy. @sideEffect starts a transaction and commits or rolls back namespace-scoped flow changes.
type UnitOfWork ¶
type UnitOfWork struct {
// contains filtered or unexported fields
}
UnitOfWork implements the ingest atomicity boundary with GORM transactions. @intent coordinate graph and search writes without exposing GORM to application policy.
func NewUnitOfWork ¶
func NewUnitOfWork(db *gorm.DB, newSearchWriter SearchWriterFactory) *UnitOfWork
NewUnitOfWork constructs a GORM-backed ingest unit of work. @intent inject the database transaction owner and transaction-scoped search writer factory.
func (*UnitOfWork) WithinTransaction ¶
func (u *UnitOfWork) WithinTransaction(ctx context.Context, fn func(ingest.Transaction) error) error
WithinTransaction executes graph and search work against one GORM transaction. @intent commit graph and derived search state together or roll both back on any callback error. @sideEffect starts a database transaction and commits or rolls it back. @ensures the callback is not invoked unless both transaction capabilities are available.