infra

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNeo4jRepository

func NewNeo4jRepository(config *Neo4jConfig) (graph.Repository, error)

NewNeo4jRepository creates a new Neo4j repository

Types

type Neo4jConfig

type Neo4jConfig struct {
	URI        string // Neo4j connection URI
	Username   string // Username for authentication
	Password   string // Password for authentication
	Database   string // Database name (optional)
	MaxRetries int    // Maximum retry attempts
	BatchSize  int    // Batch size for bulk operations
}

Neo4jConfig holds Neo4j connection configuration

type Neo4jRepository

type Neo4jRepository struct {
	// contains filtered or unexported fields
}

Neo4jRepository implements the graph.Repository interface

func (*Neo4jRepository) ClearProject

func (r *Neo4jRepository) ClearProject(ctx context.Context, projectID core.ID) error

ClearProject removes all nodes and relationships for a specific project

func (*Neo4jRepository) Close

func (r *Neo4jRepository) Close() error

Close closes the Neo4j connection

func (*Neo4jRepository) Connect

func (r *Neo4jRepository) Connect(ctx context.Context, uri, username, password string) error

Connect establishes a connection to Neo4j with retry logic

func (*Neo4jRepository) CreateNode

func (r *Neo4jRepository) CreateNode(ctx context.Context, node *core.Node) error

CreateNode creates a new node in the graph

func (*Neo4jRepository) CreateNodes

func (r *Neo4jRepository) CreateNodes(ctx context.Context, nodes []core.Node) error

CreateNodes creates multiple nodes in a batch using optimized batch processing

func (*Neo4jRepository) CreateRelationship

func (r *Neo4jRepository) CreateRelationship(ctx context.Context, rel *core.Relationship) error

CreateRelationship creates a new relationship

func (*Neo4jRepository) CreateRelationships

func (r *Neo4jRepository) CreateRelationships(ctx context.Context, rels []core.Relationship) error

CreateRelationships creates multiple relationships in a batch using optimized batch processing

func (*Neo4jRepository) DeleteNode

func (r *Neo4jRepository) DeleteNode(ctx context.Context, id core.ID) error

DeleteNode deletes a node by ID

func (*Neo4jRepository) DeleteRelationship

func (r *Neo4jRepository) DeleteRelationship(ctx context.Context, id core.ID) error

DeleteRelationship deletes a relationship by ID

func (*Neo4jRepository) ExecuteQuery

func (r *Neo4jRepository) ExecuteQuery(
	ctx context.Context,
	query string,
	params map[string]any,
) ([]map[string]any, error)

ExecuteQuery runs a Cypher query and returns results

func (*Neo4jRepository) FindNodesByName

func (r *Neo4jRepository) FindNodesByName(
	ctx context.Context,
	name string,
	projectID core.ID,
) ([]core.Node, error)

FindNodesByName finds nodes by name

func (*Neo4jRepository) FindNodesByType

func (r *Neo4jRepository) FindNodesByType(
	ctx context.Context,
	nodeType core.NodeType,
	projectID core.ID,
) ([]core.Node, error)

FindNodesByType finds all nodes of a specific type

func (*Neo4jRepository) FindRelationshipsByType

func (r *Neo4jRepository) FindRelationshipsByType(
	ctx context.Context,
	relType core.RelationType,
	projectID core.ID,
) ([]core.Relationship, error)

FindRelationshipsByType finds all relationships of a specific type

func (*Neo4jRepository) GetNode

func (r *Neo4jRepository) GetNode(ctx context.Context, id core.ID) (*core.Node, error)

GetNode retrieves a node by ID

func (*Neo4jRepository) GetRelationship

func (r *Neo4jRepository) GetRelationship(ctx context.Context, id core.ID) (*core.Relationship, error)

GetRelationship retrieves a relationship by ID

func (*Neo4jRepository) ImportAnalysisResult

func (r *Neo4jRepository) ImportAnalysisResult(ctx context.Context, result *core.AnalysisResult) error

ImportAnalysisResult imports an entire analysis result with optimized batch processing

func (*Neo4jRepository) StoreAnalysis

func (r *Neo4jRepository) StoreAnalysis(ctx context.Context, result *core.AnalysisResult) error

StoreAnalysis stores the complete analysis result in Neo4j

func (*Neo4jRepository) UpdateNode

func (r *Neo4jRepository) UpdateNode(ctx context.Context, node *core.Node) error

UpdateNode updates an existing node

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL