Documentation
¶
Index ¶
- Variables
- type Buffer
- type CodeGraph
- func (cg *CodeGraph) BatchCreateRelations(ctx context.Context, relations []RelationSpec) error
- func (cg *CodeGraph) BatchUpdateNodeMetaData(ctx context.Context, updates map[ast.NodeID]map[string]any) error
- func (cg *CodeGraph) BatchWriteNodes(ctx context.Context, nodes []*ast.Node) error
- func (cg *CodeGraph) CleanRepository(ctx context.Context, repoName string) error
- func (cg *CodeGraph) CleanupFileBuffers(ctx context.Context, fileID int32) error
- func (cg *CodeGraph) Close(ctx context.Context) error
- func (cg *CodeGraph) CreateAliasRelation(ctx context.Context, aliasNodeID, originalNodeID ast.NodeID, fileID int32) error
- func (cg *CodeGraph) CreateAnnotationRelation(ctx context.Context, parentNodeID, annotationNodeID ast.NodeID, fileID int32) error
- func (cg *CodeGraph) CreateBlock(ctx context.Context, node *ast.Node) error
- func (cg *CodeGraph) CreateBodyRelation(ctx context.Context, parentNodeID, bodyNodeID ast.NodeID, fileID int32) error
- func (cg *CodeGraph) CreateCallsFunctionRelation(ctx context.Context, callerNodeID, calleeNodeID ast.NodeID, fileID int32) error
- func (cg *CodeGraph) CreateCallsRelation(ctx context.Context, callerNodeID, calleeNodeID ast.NodeID, fileID int32) error
- func (cg *CodeGraph) CreateClass(ctx context.Context, node *ast.Node) error
- func (cg *CodeGraph) CreateConditional(ctx context.Context, node *ast.Node) error
- func (cg *CodeGraph) CreateConditionalRelation(ctx context.Context, condNodeID, branchNodeID ast.NodeID, position int, ...) error
- func (cg *CodeGraph) CreateContainsRelation(ctx context.Context, parentNodeID, childNodeID ast.NodeID, fileID int32) error
- func (cg *CodeGraph) CreateDataFlowRelation(ctx context.Context, sourceNodeID, targetNodeID ast.NodeID, fileID int32) error
- func (cg *CodeGraph) CreateExpression(ctx context.Context, node *ast.Node) error
- func (cg *CodeGraph) CreateField(ctx context.Context, node *ast.Node) error
- func (cg *CodeGraph) CreateFileScope(ctx context.Context, node *ast.Node) error
- func (cg *CodeGraph) CreateFromRelation(ctx context.Context, fromNodeID, toNodeID ast.NodeID, fileID int32) error
- func (cg *CodeGraph) CreateFunction(ctx context.Context, node *ast.Node) error
- func (cg *CodeGraph) CreateFunctionArgRelation(ctx context.Context, functionNodeID, argNodeID ast.NodeID, position int, ...) error
- func (cg *CodeGraph) CreateFunctionCall(ctx context.Context, node *ast.Node) error
- func (cg *CodeGraph) CreateFunctionCallArgRelation(ctx context.Context, callNodeID, argNodeID ast.NodeID, position int, ...) error
- func (cg *CodeGraph) CreateHasFieldRelation(ctx context.Context, parentNodeID, childNodeID ast.NodeID, fileID int32) error
- func (cg *CodeGraph) CreateImport(ctx context.Context, node *ast.Node) error
- func (cg *CodeGraph) CreateImportsRelation(ctx context.Context, importerNodeID, importedNodeID ast.NodeID, fileID int32) error
- func (cg *CodeGraph) CreateInheritsRelation(ctx context.Context, parentNodeID, childNodeID ast.NodeID, fileID int32) error
- func (cg *CodeGraph) CreateLoop(ctx context.Context, node *ast.Node) error
- func (cg *CodeGraph) CreateModuleScope(ctx context.Context, node *ast.Node) error
- func (cg *CodeGraph) CreateRelation(ctx context.Context, parentNodeID, childNodeID ast.NodeID, ...) error
- func (cg *CodeGraph) CreateRelationReal(ctx context.Context, parentNodeID, childNodeID ast.NodeID, ...) error
- func (cg *CodeGraph) CreateReturnsRelation(ctx context.Context, functionNodeID, returnNodeID ast.NodeID, fileID int32) error
- func (cg *CodeGraph) CreateUsesVariableRelation(ctx context.Context, userNodeID, variableNodeID ast.NodeID, fileID int32) error
- func (cg *CodeGraph) CreateVariable(ctx context.Context, node *ast.Node) error
- func (cg *CodeGraph) DumpToFile(ctx context.Context, filePath string, repoNames []string) error
- func (cg *CodeGraph) ExecuteRead(ctx context.Context, query string, params map[string]any) ([]map[string]any, error)
- func (cg *CodeGraph) ExecuteReadSingle(ctx context.Context, query string, params map[string]any) (map[string]any, error)
- func (cg *CodeGraph) ExecuteWrite(ctx context.Context, query string, params map[string]any) ([]map[string]any, error)
- func (cg *CodeGraph) FindAllClassesInFile(ctx context.Context, fileID int32) ([]*ast.Node, error)
- func (cg *CodeGraph) FindAllClassesWithInheritance(ctx context.Context, repoName string) ([]*ast.Node, error)
- func (cg *CodeGraph) FindClassByName(ctx context.Context, filePath string, className string) (*ast.Node, error)
- func (cg *CodeGraph) FindClassInModule(ctx context.Context, name string, moduleName string) ([]*ast.Node, error)
- func (cg *CodeGraph) FindClassesByNameInRepo(ctx context.Context, name string, repoName string) ([]*ast.Node, error)
- func (cg *CodeGraph) FindConstructorCallsInFile(ctx context.Context, fileID int32) ([]*ast.Node, error)
- func (cg *CodeGraph) FindFileByPath(ctx context.Context, repoName string, filePath string) (*ast.Node, error)
- func (cg *CodeGraph) FindFileScopes(ctx context.Context, repoName, filePath string) ([]*ast.Node, error)
- func (cg *CodeGraph) FindFunctionByName(ctx context.Context, filePath string, functionName string) (*ast.Node, error)
- func (cg *CodeGraph) FindFunctionCalls(ctx context.Context, fileID ast.NodeID) (map[ast.NodeID][]*ast.Node, error)
- func (cg *CodeGraph) FindFunctionsByFileID(ctx context.Context, fileID int32) ([]*ast.Node, error)
- func (cg *CodeGraph) FindFunctionsByFilePath(ctx context.Context, repoName string, filePath string) ([]*ast.Node, error)
- func (cg *CodeGraph) FindFunctionsByName(ctx context.Context, fileID int, name string) ([]*ast.Node, error)
- func (cg *CodeGraph) FindNodesByNameAndTypeInFile(ctx context.Context, name string, nodeType ast.NodeType, fileID int32) ([]*ast.Node, error)
- func (cg *CodeGraph) Flush(ctx context.Context, fileID *int32) error
- func (cg *CodeGraph) FlushNodes(ctx context.Context, fileID *int32) error
- func (cg *CodeGraph) FlushRelations(ctx context.Context, fileID *int32) error
- func (cg *CodeGraph) GetChildNodes(ctx context.Context, parentID ast.NodeID, relationLabel string, ...) ([]*ast.Node, error)
- func (cg *CodeGraph) GetClassMethods(ctx context.Context, classID ast.NodeID) ([]*ast.Node, error)
- func (cg *CodeGraph) GetConstructorsOfClass(ctx context.Context, classID ast.NodeID) ([]*ast.Node, error)
- func (cg *CodeGraph) GetContainingClass(ctx context.Context, methodID ast.NodeID) (*ast.Node, error)
- func (cg *CodeGraph) GetFieldOwnerClass(ctx context.Context, fieldID ast.NodeID) (*ast.Node, error)
- func (cg *CodeGraph) GetFieldsAccessedByMethod(ctx context.Context, methodID ast.NodeID) ([]*ast.Node, error)
- func (cg *CodeGraph) GetFieldsAccessedViaThis(ctx context.Context, methodID ast.NodeID) ([]*ast.Node, error)
- func (cg *CodeGraph) GetFieldsOfClass(ctx context.Context, classID ast.NodeID) ([]*ast.Node, error)
- func (cg *CodeGraph) GetFieldsWrittenByMethod(ctx context.Context, methodID ast.NodeID) ([]*ast.Node, error)
- func (cg *CodeGraph) GetFilePath(ctx context.Context, fileID int32) string
- func (cg *CodeGraph) GetIncomingRelations(ctx context.Context, toNodeID ast.NodeID, relationLabel string) ([]RelationInfo, error)
- func (cg *CodeGraph) GetMethodsOfClass(ctx context.Context, classID ast.NodeID) ([]*ast.Node, error)
- func (cg *CodeGraph) GetModuleName(ctx context.Context, fileId int32) (string, error)
- func (cg *CodeGraph) GetNodeByID(ctx context.Context, nodeID ast.NodeID) (*ast.Node, error)
- func (cg *CodeGraph) GetNodesByName(ctx context.Context, name string, nodeType ast.NodeType) ([]*ast.Node, error)
- func (cg *CodeGraph) GetNodesByType(ctx context.Context, nodeType ast.NodeType) ([]*ast.Node, error)
- func (cg *CodeGraph) GetNodesByTypeAndFileID(ctx context.Context, nodeType ast.NodeType, fileID int32) ([]*ast.Node, error)
- func (cg *CodeGraph) GetOutgoingRelations(ctx context.Context, fromNodeID ast.NodeID, relationLabel string) ([]RelationInfo, error)
- func (cg *CodeGraph) GetThisClassForMethod(ctx context.Context, methodID ast.NodeID) (*ast.Node, error)
- func (cg *CodeGraph) InitializeFileBuffers(fileID int32)
- func (cg *CodeGraph) IsFieldWrittenInMethod(ctx context.Context, methodID ast.NodeID, fieldID ast.NodeID) (bool, error)
- func (t *CodeGraph) MarkThis(ctx context.Context, fileID int32, thisNodeId ast.NodeID, ...)
- func (cg *CodeGraph) ReadBlock(ctx context.Context, nodeID ast.NodeID) (*ast.Node, error)
- func (cg *CodeGraph) ReadClass(ctx context.Context, nodeID ast.NodeID) (*ast.Node, error)
- func (cg *CodeGraph) ReadConditional(ctx context.Context, nodeID ast.NodeID) (*ast.Node, error)
- func (cg *CodeGraph) ReadExpression(ctx context.Context, nodeID ast.NodeID) (*ast.Node, error)
- func (cg *CodeGraph) ReadField(ctx context.Context, nodeID ast.NodeID) (*ast.Node, error)
- func (cg *CodeGraph) ReadFileScope(ctx context.Context, nodeID ast.NodeID) (*ast.Node, error)
- func (cg *CodeGraph) ReadFunction(ctx context.Context, nodeID ast.NodeID) (*ast.Node, error)
- func (cg *CodeGraph) ReadFunctionCall(ctx context.Context, nodeID ast.NodeID) (*ast.Node, error)
- func (cg *CodeGraph) ReadImport(ctx context.Context, nodeID ast.NodeID) (*ast.Node, error)
- func (cg *CodeGraph) ReadModuleScope(ctx context.Context, nodeID ast.NodeID) (*ast.Node, error)
- func (cg *CodeGraph) ReadVariable(ctx context.Context, nodeID ast.NodeID) (*ast.Node, error)
- func (cg *CodeGraph) UpdateFakeClasses(ctx context.Context, fileID int32) error
- func (cg *CodeGraph) UpdateNodeMetaData(ctx context.Context, nodeID ast.NodeID, fileID int32, metadata map[string]any) error
- type GraphDatabase
- type GraphNode
- type Neo4jDatabase
- func (db *Neo4jDatabase) Close(ctx context.Context) error
- func (db *Neo4jDatabase) ExecuteRead(ctx context.Context, query string, params map[string]any) ([]map[string]any, error)
- func (db *Neo4jDatabase) ExecuteReadSingle(ctx context.Context, query string, params map[string]any) (map[string]any, error)
- func (db *Neo4jDatabase) ExecuteWrite(ctx context.Context, query string, params map[string]any) ([]map[string]any, error)
- func (db *Neo4jDatabase) ExecuteWriteSingle(ctx context.Context, query string, params map[string]any) (map[string]any, error)
- func (db *Neo4jDatabase) VerifyConnectivity(ctx context.Context) error
- type Neo4jNode
- type RelationInfo
- type RelationSpec
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
Nodes []*ast.Node
Relations []RelationSpec
}
type CodeGraph ¶
type CodeGraph struct {
// contains filtered or unexported fields
}
func NewCodeGraph ¶
func (*CodeGraph) BatchCreateRelations ¶
func (cg *CodeGraph) BatchCreateRelations(ctx context.Context, relations []RelationSpec) error
BatchCreateRelations creates multiple relationships in a single database transaction This is much faster than individual CreateRelation calls for bulk operations
func (*CodeGraph) BatchUpdateNodeMetaData ¶
func (cg *CodeGraph) BatchUpdateNodeMetaData(ctx context.Context, updates map[ast.NodeID]map[string]any) error
BatchUpdateNodeMetaData updates metadata for multiple nodes in a single transaction This is more efficient than calling UpdateNodeMetaData multiple times
func (*CodeGraph) BatchWriteNodes ¶
BatchWriteNodes writes multiple nodes in a single database transaction using UNWIND This is much faster than individual writeNode calls for bulk operations
func (*CodeGraph) CleanRepository ¶
CleanRepository deletes all nodes and relationships for a specific repository from Neo4j. This includes all FileScopes and their descendant nodes (functions, classes, variables, etc.)
func (*CodeGraph) CleanupFileBuffers ¶
CleanupFileBuffers flushes and removes buffers for a file after processing completes This frees memory and ensures data is written to database
func (*CodeGraph) CreateAliasRelation ¶
func (*CodeGraph) CreateAnnotationRelation ¶
func (*CodeGraph) CreateBlock ¶
func (*CodeGraph) CreateBodyRelation ¶
func (*CodeGraph) CreateCallsFunctionRelation ¶
func (*CodeGraph) CreateCallsRelation ¶
func (*CodeGraph) CreateClass ¶
func (*CodeGraph) CreateConditional ¶
func (*CodeGraph) CreateConditionalRelation ¶
func (*CodeGraph) CreateContainsRelation ¶
func (*CodeGraph) CreateDataFlowRelation ¶
func (*CodeGraph) CreateExpression ¶
func (*CodeGraph) CreateField ¶
func (*CodeGraph) CreateFileScope ¶
func (*CodeGraph) CreateFromRelation ¶
func (*CodeGraph) CreateFunction ¶
func (*CodeGraph) CreateFunctionArgRelation ¶
func (*CodeGraph) CreateFunctionCall ¶
func (*CodeGraph) CreateFunctionCallArgRelation ¶
func (*CodeGraph) CreateHasFieldRelation ¶
func (*CodeGraph) CreateImport ¶
func (*CodeGraph) CreateImportsRelation ¶
func (*CodeGraph) CreateInheritsRelation ¶
func (*CodeGraph) CreateLoop ¶
func (*CodeGraph) CreateModuleScope ¶
func (*CodeGraph) CreateRelation ¶
func (*CodeGraph) CreateRelationReal ¶
func (*CodeGraph) CreateReturnsRelation ¶
func (*CodeGraph) CreateUsesVariableRelation ¶
func (*CodeGraph) CreateVariable ¶
func (*CodeGraph) DumpToFile ¶
DumpToFile dumps the code graph for the specified repositories to a file. FileScopes are output in alphabetical order by their path. For each FileScope, all nodes and relations within that file are dumped.
func (*CodeGraph) ExecuteRead ¶
func (cg *CodeGraph) ExecuteRead(ctx context.Context, query string, params map[string]any) ([]map[string]any, error)
ExecuteRead executes a read-only Cypher query and returns the raw records. This is exposed for use by higher-level query APIs (e.g., codeapi package).
func (*CodeGraph) ExecuteReadSingle ¶
func (cg *CodeGraph) ExecuteReadSingle(ctx context.Context, query string, params map[string]any) (map[string]any, error)
ExecuteReadSingle executes a read-only Cypher query expecting a single record. Returns error if no records found.
func (*CodeGraph) ExecuteWrite ¶
func (cg *CodeGraph) ExecuteWrite(ctx context.Context, query string, params map[string]any) ([]map[string]any, error)
ExecuteWrite executes a write Cypher query and returns the raw records. This is exposed for use by higher-level query APIs (e.g., codeapi package).
func (*CodeGraph) FindAllClassesInFile ¶
FindAllClassesInFile returns all classes in a file.
func (*CodeGraph) FindAllClassesWithInheritance ¶
func (cg *CodeGraph) FindAllClassesWithInheritance(ctx context.Context, repoName string) ([]*ast.Node, error)
FindAllClassesWithInheritance returns all classes in a repository that have extends or implements metadata.
func (*CodeGraph) FindClassByName ¶
func (cg *CodeGraph) FindClassByName(ctx context.Context, filePath string, className string) (*ast.Node, error)
FindClassByName finds a class by name within a file path
func (*CodeGraph) FindClassInModule ¶
func (*CodeGraph) FindClassesByNameInRepo ¶
func (cg *CodeGraph) FindClassesByNameInRepo(ctx context.Context, name string, repoName string) ([]*ast.Node, error)
FindClassesByNameInRepo finds all classes with the given name in a repository. This is useful for inheritance resolution where a class may extend another class in a different file.
func (*CodeGraph) FindConstructorCallsInFile ¶
func (cg *CodeGraph) FindConstructorCallsInFile(ctx context.Context, fileID int32) ([]*ast.Node, error)
FindConstructorCallsInFile returns all constructor calls (new expressions) in a file. These are FunctionCall nodes with is_constructor=true metadata.
func (*CodeGraph) FindFileByPath ¶
func (cg *CodeGraph) FindFileByPath(ctx context.Context, repoName string, filePath string) (*ast.Node, error)
FindFileByPath finds a file node by its path in a repository
func (*CodeGraph) FindFileScopes ¶
func (*CodeGraph) FindFunctionByName ¶
func (cg *CodeGraph) FindFunctionByName(ctx context.Context, filePath string, functionName string) (*ast.Node, error)
FindFunctionByName finds a function by name within a file path
func (*CodeGraph) FindFunctionCalls ¶
func (*CodeGraph) FindFunctionsByFileID ¶
FindFunctionsByFileID returns all Function nodes in a file identified by file ID
func (*CodeGraph) FindFunctionsByFilePath ¶
func (cg *CodeGraph) FindFunctionsByFilePath(ctx context.Context, repoName string, filePath string) ([]*ast.Node, error)
FindFunctionsByFilePath returns all Function nodes in a file identified by repo name and file path
func (*CodeGraph) FindFunctionsByName ¶
func (*CodeGraph) FindNodesByNameAndTypeInFile ¶
func (*CodeGraph) Flush ¶
Flush writes buffered nodes and relations to the database If fileID is provided, only flushes buffers for that file If fileID is nil, flushes all buffers IMPORTANT: Nodes are flushed BEFORE relations to ensure they exist in the database
func (*CodeGraph) FlushNodes ¶
FlushNodes writes buffered nodes to the database If fileID is provided, only flushes nodes for that file If fileID is nil, flushes all buffered nodes
func (*CodeGraph) FlushRelations ¶
FlushRelations writes buffered relations to the database If fileID is provided, only flushes relations for that file If fileID is nil, flushes all buffered relations
func (*CodeGraph) GetChildNodes ¶
func (cg *CodeGraph) GetChildNodes(ctx context.Context, parentID ast.NodeID, relationLabel string, childType ast.NodeType) ([]*ast.Node, error)
GetChildNodes returns all child nodes of a given parent via a relationship
func (*CodeGraph) GetClassMethods ¶
GetClassMethods returns all method nodes for a class
func (*CodeGraph) GetConstructorsOfClass ¶
func (cg *CodeGraph) GetConstructorsOfClass(ctx context.Context, classID ast.NodeID) ([]*ast.Node, error)
GetConstructorsOfClass returns all constructors of a class. These are Function nodes with is_constructor=true contained by the class.
func (*CodeGraph) GetContainingClass ¶
func (cg *CodeGraph) GetContainingClass(ctx context.Context, methodID ast.NodeID) (*ast.Node, error)
GetContainingClass returns the class that contains a method
func (*CodeGraph) GetFieldOwnerClass ¶
GetFieldOwnerClass returns the class that owns a field
func (*CodeGraph) GetFieldsAccessedByMethod ¶
func (cg *CodeGraph) GetFieldsAccessedByMethod(ctx context.Context, methodID ast.NodeID) ([]*ast.Node, error)
GetFieldsAccessedByMethod returns all Field nodes contained within a method (directly or nested)
func (*CodeGraph) GetFieldsAccessedViaThis ¶
func (cg *CodeGraph) GetFieldsAccessedViaThis(ctx context.Context, methodID ast.NodeID) ([]*ast.Node, error)
GetFieldsAccessedViaThis returns fields accessed through the "this" receiver in a method Pattern: (method)-[:CONTAINS*]->(thisVar)-[:THIS]->(class), (thisVar)-[:HAS_FIELD*]->(field)
func (*CodeGraph) GetFieldsOfClass ¶
GetFieldsOfClass returns all fields contained by a class
func (*CodeGraph) GetFieldsWrittenByMethod ¶
func (cg *CodeGraph) GetFieldsWrittenByMethod(ctx context.Context, methodID ast.NodeID) ([]*ast.Node, error)
GetFieldsWrittenByMethod returns all fields that are written to within a method (fields that are targets of DATA_FLOW relationships)
func (*CodeGraph) GetFilePath ¶
func (*CodeGraph) GetIncomingRelations ¶
func (cg *CodeGraph) GetIncomingRelations(ctx context.Context, toNodeID ast.NodeID, relationLabel string) ([]RelationInfo, error)
GetIncomingRelations returns all incoming relationships to a node
func (*CodeGraph) GetMethodsOfClass ¶
func (cg *CodeGraph) GetMethodsOfClass(ctx context.Context, classID ast.NodeID) ([]*ast.Node, error)
GetMethodsOfClass returns all methods (functions) contained by a class
func (*CodeGraph) GetModuleName ¶
func (*CodeGraph) GetNodeByID ¶
GetNodeByID returns a node by its ID
func (*CodeGraph) GetNodesByName ¶
func (cg *CodeGraph) GetNodesByName(ctx context.Context, name string, nodeType ast.NodeType) ([]*ast.Node, error)
GetNodesByName returns all nodes with a given name and type
func (*CodeGraph) GetNodesByType ¶
func (cg *CodeGraph) GetNodesByType(ctx context.Context, nodeType ast.NodeType) ([]*ast.Node, error)
GetNodesByType returns all nodes of a given type
func (*CodeGraph) GetNodesByTypeAndFileID ¶
func (cg *CodeGraph) GetNodesByTypeAndFileID(ctx context.Context, nodeType ast.NodeType, fileID int32) ([]*ast.Node, error)
GetNodesByTypeAndFileID returns all nodes of a given type in a specific file
func (*CodeGraph) GetOutgoingRelations ¶
func (cg *CodeGraph) GetOutgoingRelations(ctx context.Context, fromNodeID ast.NodeID, relationLabel string) ([]RelationInfo, error)
GetOutgoingRelations returns all outgoing relationships from a node
func (*CodeGraph) GetThisClassForMethod ¶
func (cg *CodeGraph) GetThisClassForMethod(ctx context.Context, methodID ast.NodeID) (*ast.Node, error)
GetThisClassForMethod returns the class that the method's receiver (this) points to
func (*CodeGraph) InitializeFileBuffers ¶
InitializeFileBuffers initializes buffers for a file before processing starts This reduces lock contention during writeNode/CreateRelation calls
func (*CodeGraph) IsFieldWrittenInMethod ¶
func (cg *CodeGraph) IsFieldWrittenInMethod(ctx context.Context, methodID ast.NodeID, fieldID ast.NodeID) (bool, error)
IsFieldWrittenInMethod checks if a field has an incoming DATA_FLOW relationship within the scope of a method, indicating the field is being written to
func (*CodeGraph) ReadConditional ¶
func (*CodeGraph) ReadExpression ¶
func (*CodeGraph) ReadFileScope ¶
func (*CodeGraph) ReadFunction ¶
func (*CodeGraph) ReadFunctionCall ¶
func (*CodeGraph) ReadImport ¶
func (*CodeGraph) ReadModuleScope ¶
func (*CodeGraph) ReadVariable ¶
func (*CodeGraph) UpdateFakeClasses ¶
func (*CodeGraph) UpdateNodeMetaData ¶
func (cg *CodeGraph) UpdateNodeMetaData(ctx context.Context, nodeID ast.NodeID, fileID int32, metadata map[string]any) error
UpdateNodeMetaData updates the metadata of an existing node Works in both batch and non-batch write modes In batch mode: updates the buffered node if it exists, otherwise performs immediate update In non-batch mode: performs immediate update to database
type GraphDatabase ¶
type GraphDatabase interface {
// ExecuteRead executes a read-only Cypher query and returns the raw records
ExecuteRead(ctx context.Context, query string, params map[string]any) ([]map[string]any, error)
// ExecuteWrite executes a write Cypher query and returns the raw records
ExecuteWrite(ctx context.Context, query string, params map[string]any) ([]map[string]any, error)
// ExecuteReadSingle executes a read-only Cypher query expecting a single record
ExecuteReadSingle(ctx context.Context, query string, params map[string]any) (map[string]any, error)
// ExecuteWriteSingle executes a write Cypher query expecting a single record
ExecuteWriteSingle(ctx context.Context, query string, params map[string]any) (map[string]any, error)
// Close closes the database connection
Close(ctx context.Context) error
// VerifyConnectivity checks if the database connection is working
VerifyConnectivity(ctx context.Context) error
}
GraphDatabase represents a generic graph database interface for executing Cypher queries
type GraphNode ¶
GraphNode represents a node returned from the graph database
func WrapNeo4jNode ¶
WrapNeo4jNode wraps a Neo4j node in our GraphNode interface
type Neo4jDatabase ¶
type Neo4jDatabase struct {
// contains filtered or unexported fields
}
Neo4jDatabase implements the GraphDatabase interface using Neo4j
func NewNeo4jDatabase ¶
func NewNeo4jDatabase(uri, username, password string, logger *zap.Logger) (*Neo4jDatabase, error)
NewNeo4jDatabase creates a new Neo4j database instance
func (*Neo4jDatabase) Close ¶
func (db *Neo4jDatabase) Close(ctx context.Context) error
Close closes the database connection
func (*Neo4jDatabase) ExecuteRead ¶
func (db *Neo4jDatabase) ExecuteRead(ctx context.Context, query string, params map[string]any) ([]map[string]any, error)
ExecuteRead executes a read-only Cypher query and returns the raw records
func (*Neo4jDatabase) ExecuteReadSingle ¶
func (db *Neo4jDatabase) ExecuteReadSingle(ctx context.Context, query string, params map[string]any) (map[string]any, error)
ExecuteReadSingle executes a read-only Cypher query expecting a single record
func (*Neo4jDatabase) ExecuteWrite ¶
func (db *Neo4jDatabase) ExecuteWrite(ctx context.Context, query string, params map[string]any) ([]map[string]any, error)
ExecuteWrite executes a write Cypher query and returns the raw records
func (*Neo4jDatabase) ExecuteWriteSingle ¶
func (db *Neo4jDatabase) ExecuteWriteSingle(ctx context.Context, query string, params map[string]any) (map[string]any, error)
ExecuteWriteSingle executes a write Cypher query expecting a single record
func (*Neo4jDatabase) VerifyConnectivity ¶
func (db *Neo4jDatabase) VerifyConnectivity(ctx context.Context) error
VerifyConnectivity checks if the database connection is working
type Neo4jNode ¶
type Neo4jNode struct {
// contains filtered or unexported fields
}
Neo4jNode wraps a Neo4j node to implement the GraphNode interface
func (*Neo4jNode) GetProperties ¶
GetProperties returns the node properties
type RelationInfo ¶
RelationInfo represents a relationship between nodes