Documentation
¶
Index ¶
- Constants
- type Algorithm
- type Condition
- type ConditionGroup
- type Executor
- type Job
- type JobManager
- type JobStatus
- type NodePattern
- type Operator
- type OrderByItem
- type OrderDirection
- type Parser
- type PathElement
- type Query
- type QueryResult
- type QueryStats
- type RelDirection
- type RelPattern
- type ReturnItem
Constants ¶
const ( ErrJobNotFound = jobError("job not found") ErrJobNotComplete = jobError("job not completed") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Condition ¶
type Condition struct {
VarPath string // e.g., "u.name"
Operator Operator // e.g., "="
Value interface{} // e.g., "Alice" or 123
}
Condition represents a WHERE condition
type ConditionGroup ¶
type ConditionGroup struct {
Conditions []Condition
}
ConditionGroup represents conditions joined by AND (groups are joined by OR)
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor executes Sulpher queries against a graph
func NewExecutor ¶
func NewExecutor(g *graph.IndexedGraph, maxDepth int) *Executor
NewExecutor creates a new query executor
type Job ¶
type Job struct {
ID string `json:"id"`
Query string `json:"query"`
Status JobStatus `json:"status"`
Result *QueryResult `json:"result,omitempty"`
Error string `json:"error,omitempty"`
CreatedAt time.Time `json:"created_at"`
StartedAt *time.Time `json:"started_at,omitempty"`
EndedAt *time.Time `json:"ended_at,omitempty"`
MaxDepth int `json:"max_depth"`
}
Job represents an async query job
type JobManager ¶
type JobManager struct {
// contains filtered or unexported fields
}
JobManager manages async query jobs
func NewJobManager ¶
func NewJobManager(executor *Executor, ttl time.Duration) *JobManager
NewJobManager creates a new job manager
func (*JobManager) ExecuteSync ¶
func (jm *JobManager) ExecuteSync(queryStr string, maxDepth int) (*QueryResult, error)
ExecuteSync executes a query synchronously
func (*JobManager) GetJob ¶
func (jm *JobManager) GetJob(id string) (*Job, bool)
GetJob retrieves a job by ID
func (*JobManager) GetJobResult ¶
func (jm *JobManager) GetJobResult(id string) (*QueryResult, error)
GetJobResult retrieves the result of a completed job
type NodePattern ¶
type NodePattern struct {
Variable string // e.g., "u"
Type string // e.g., "User" (optional)
Properties map[string]interface{} // inline properties like {id: 123}
}
NodePattern represents a node in the query pattern
type OrderByItem ¶
type OrderByItem struct {
VarPath string // e.g., "u.name"
Direction OrderDirection // ASC or DESC
}
OrderByItem represents an ORDER BY clause item
type OrderDirection ¶
type OrderDirection string
OrderDirection represents sort direction
const ( OrderAsc OrderDirection = "ASC" OrderDesc OrderDirection = "DESC" )
type PathElement ¶
type PathElement struct {
Node NodePattern
Relationship *RelPattern // nil for the last node
}
PathElement represents one step in the path pattern
type Query ¶
type Query struct {
Algorithm Algorithm
Path []PathElement
Conditions []Condition // Legacy: simple AND-joined conditions
ConditionGroups []ConditionGroup // OR-joined groups of AND-joined conditions
ReturnItems []ReturnItem
Distinct bool // RETURN DISTINCT
OrderBy []OrderByItem // ORDER BY clause
Limit int // LIMIT clause (0 = no limit)
RawQuery string
}
Query represents a parsed Sulpher query
type QueryResult ¶
type QueryResult struct {
Data []map[string]interface{} `json:"data"`
Stats QueryStats `json:"stats"`
}
QueryResult represents the result of a query execution
type QueryStats ¶
type QueryStats struct {
NodesTraversed int `json:"nodes_traversed"`
PathsFound int `json:"paths_found"`
ExecutionTime time.Duration `json:"execution_time_ms"`
}
QueryStats contains execution statistics
type RelDirection ¶
type RelDirection int
RelDirection represents relationship direction
const ( RelOutgoing RelDirection = iota // -[r]-> RelIncoming // <-[r]- RelBidirectional // -[r]- or <-[r]-> )
type RelPattern ¶
type RelPattern struct {
Variable string // e.g., "r" (optional)
Type string // e.g., "FOLLOWS" (optional)
MinHops int // Minimum hops (0 = no minimum, default 1)
MaxHops int // Maximum hops (0 = unlimited, use query max_depth)
IsVariable bool // True if *min..max syntax was used
Direction RelDirection // Direction of traversal
}
RelPattern represents a relationship in the query pattern
type ReturnItem ¶
type ReturnItem struct {
Variable string // e.g., "u"
Property string // e.g., "name" (empty if returning whole node)
}
ReturnItem represents an item in the RETURN clause