Documentation
¶
Overview ¶
Package cypher provides Cypher query parsing and execution capabilities for gograph. It includes a parser for Cypher syntax and an executor that coordinates the various clause handlers to process queries.
Package cypher provides Cypher query parsing and execution capabilities for gograph.
Package cypher provides Cypher query parsing and execution capabilities for gograph.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor coordinates the execution of Cypher queries by delegating to specialized clause handlers for CREATE, MATCH, SET, DELETE, and REMOVE operations.
func NewExecutor ¶
func NewExecutor(store *storage.DB, opts ...ExecutorOption) *Executor
NewExecutor creates a new Executor instance that operates on the given storage.
func (*Executor) Execute ¶
func (e *Executor) Execute(ctx context.Context, a *ast.AST, params map[string]interface{}) (Result, error)
Execute runs a Cypher query and returns the result. It automatically manages transactions, committing write operations and rolling back read-only operations.
func (*Executor) ExecuteWithTx ¶
func (e *Executor) ExecuteWithTx(t *tx.Transaction, a *ast.AST, params map[string]interface{}) (Result, error)
ExecuteWithTx runs a Cypher query within an existing transaction. It is intended for advanced use cases where transaction management is handled externally.
type ExecutorOption ¶
type ExecutorOption func(*Executor)
ExecutorOption configures optional parameters for the executor.
func WithObservability ¶
func WithObservability(o *Observability) ExecutorOption
WithObservability sets the observability handler for tracing and metrics.
type Logger ¶
type Logger interface {
Debug(msg string, args ...any)
Info(msg string, args ...any)
Warn(msg string, args ...any)
Error(msg string, args ...any)
}
Logger defines the interface for logging operations.
type Meter ¶
type Meter interface {
RecordHistogram(ctx context.Context, name string, value float64, attrs ...Attribute)
RecordCounter(ctx context.Context, name string, value float64, attrs ...Attribute)
}
Meter defines the interface for recording metrics.
type Observability ¶
Observability contains the logging, tracing, and metering interfaces used throughout the Cypher execution pipeline.
func NewObservability ¶
func NewObservability(opts ...ObservabilityOption) *Observability
NewObservability creates a new Observability instance with default (no-op) implementations.
type ObservabilityOption ¶
type ObservabilityOption func(*Observability)
ObservabilityOption configures optional parameters for observability.
func WithLogger ¶
func WithLogger(l Logger) ObservabilityOption
WithLogger sets the Logger implementation.
func WithMeter ¶
func WithMeter(m Meter) ObservabilityOption
WithMeter sets the Meter implementation.
func WithTracer ¶
func WithTracer(t Tracer) ObservabilityOption
WithTracer sets the Tracer implementation.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser parses Cypher query strings into AST structures.
type Result ¶
type Result struct {
// AffectedNodes is the number of nodes created, modified, or deleted.
AffectedNodes int
// AffectedRels is the number of relationships created or deleted.
AffectedRels int
// Rows contains matched data rows for MATCH queries.
Rows []map[string]interface{}
// Columns contains the names of columns returned in Rows.
Columns []string
}
Result contains the count of affected graph elements after executing a data-modifying Cypher query (CREATE, SET, DELETE, REMOVE).
func (*Result) AddAffected ¶
AddAffected increments the count of affected nodes and relationships.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package ast defines the abstract syntax tree (AST) representation for Cypher queries.
|
Package ast defines the abstract syntax tree (AST) representation for Cypher queries. |
|
Package creators provides executors for Cypher data creation clauses.
|
Package creators provides executors for Cypher data creation clauses. |
|
Package matchers provides executors for Cypher MATCH clauses and pattern matching.
|
Package matchers provides executors for Cypher MATCH clauses and pattern matching. |
|
Package modifiers provides executors for Cypher data modification clauses including SET, DELETE, and REMOVE operations.
|
Package modifiers provides executors for Cypher data modification clauses including SET, DELETE, and REMOVE operations. |