graph

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(ctx context.Context) error

Close closes the Neo4jStore connection.

func Init

func Init(cfg Neo4jConfig) error

Init initializes the graph package with config.

Types

type Neo4jConfig

type Neo4jConfig struct {
	Enabled  bool   `toml:"enabled"`
	URI      string `toml:"uri"`
	Username string `toml:"username"`
	Password string `toml:"password"`
	Database string `toml:"database"`
}

Neo4jConfig holds Neo4j connection configuration

func (*Neo4jConfig) Validate

func (c *Neo4jConfig) Validate() error

Validate checks Neo4j configuration.

type Neo4jStore

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

Neo4jStore provides a generic Neo4j graph store

func NewStore

func NewStore() *Neo4jStore

NewStore returns the Neo4jStore instance.

func (*Neo4jStore) Close

func (s *Neo4jStore) Close(ctx context.Context) error

Close closes the Neo4j connection

func (*Neo4jStore) CreateRelationship

func (s *Neo4jStore) CreateRelationship(ctx context.Context,
	fromLabel, fromKey string, fromValue any,
	toLabel, toKey string, toValue any,
	relType string, properties map[string]any) error

CreateRelationship creates a relationship between two nodes

func (*Neo4jStore) DeleteNode

func (s *Neo4jStore) DeleteNode(ctx context.Context, label, key string, value any) error

DeleteNode deletes a node and its relationships

func (*Neo4jStore) DeleteRelationship

func (s *Neo4jStore) DeleteRelationship(ctx context.Context, key string, value any) error

DeleteRelationship deletes a relationship by property

func (*Neo4jStore) FindNodes

func (s *Neo4jStore) FindNodes(ctx context.Context, label string, filters map[string]any, limit int) ([]map[string]any, error)

FindNodes finds nodes matching the given criteria

func (*Neo4jStore) FindRelationships

func (s *Neo4jStore) FindRelationships(ctx context.Context,
	fromLabel, fromKey string, fromValue any,
	relType string, limit int) ([]map[string]any, error)

FindRelationships finds relationships from a node

func (*Neo4jStore) GetNode

func (s *Neo4jStore) GetNode(ctx context.Context, label, key string, value any) (map[string]any, error)

GetNode retrieves a node by a property match

func (*Neo4jStore) Health

func (s *Neo4jStore) Health(ctx context.Context) error

Health checks Neo4j connection

func (*Neo4jStore) MergeNode

func (s *Neo4jStore) MergeNode(ctx context.Context, labels []string, matchKey string, matchValue any, properties map[string]any) error

MergeNode creates or updates a node based on a match key

func (*Neo4jStore) Run

func (s *Neo4jStore) Run(ctx context.Context, cypher string, params map[string]any) ([]map[string]any, error)

Run executes a Cypher query and returns results as []map[string]any

func (*Neo4jStore) RunWrite

func (s *Neo4jStore) RunWrite(ctx context.Context, cypher string, params map[string]any) error

RunWrite executes a write Cypher query in a transaction

func (*Neo4jStore) RunWriteBatch

func (s *Neo4jStore) RunWriteBatch(ctx context.Context, queries []string, paramsList []map[string]any) error

RunWriteBatch executes multiple write Cypher queries in a single transaction

func (*Neo4jStore) Traverse

func (s *Neo4jStore) Traverse(ctx context.Context,
	startLabel, startKey string, startValue any,
	relTypes []string, direction string,
	maxDepth, limit int) ([]map[string]any, error)

Traverse performs a graph traversal from a starting node

Jump to

Keyboard shortcuts

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