Service Package Types
Service
type Service struct {
GraphClient *client.Neo4jClient
RelationalClient *client.RelationalClient
GraphCUDPool *client.GraphWorkerPool
GraphReadPool *client.GraphWorkerPool
RelationalPool *client.RelationalWorkerPool
Logger *logrus.Logger
pendingJobs []client.GraphBatchJob
jobLock sync.Mutex
}
Service handles operations related to IngestionSystems and IngestionPoints for both Neo4j and PostgreSQL.
ReadRequest
type ReadRequest struct {
IsGraph bool
IsRelational bool
CypherQuery string
SQLQuery string
Params map[string]interface{} // Parameters for the query
GraphTranslator func(*graph.GraphNode) (graph.DatabaseInterface, error)
RelationalTranslator func(map[string]interface{}) (graph.DatabaseInterface, error)
}
ReadRequest defines the structure for a generalized read request.
ReadGraphRequest
type ReadGraphRequest struct {
Cypher string // Cypher query string
Params map[string]interface{} // Parameters for the Cypher query
GraphTranslator func(*graph.GraphNode) (graph.DatabaseInterface, error) // Function to translate graph nodes
}
ReadGraphRequest defines the structure for a graph read operation in Neo4j.
ReadSQLRequest
type ReadSQLRequest struct {
Query string // SQL query string
Params map[string]interface{} // Parameters for the SQL query
RelationalTranslator func(map[string]interface{}) (graph.DatabaseInterface, error) // Function to translate SQL rows
}
ReadSQLRequest defines the structure for a SQL read operation in PostgreSQL.
RAGReadService
type RAGReadService struct {
Client *client.Neo4jClient
ReadPool *client.GraphWorkerPool
Logger *logrus.Logger
}
RAGReadService provides read-only graph queries for use in a RAG pipeline.
Interface
type Interface interface {
// AddToQueue adds a job to the queue.
AddToQueue(job client.GraphBatchJob)
// RunQueuedJobs executes all queued jobs.
RunQueuedJobs()
// EnqueueCUDJob enqueues create/update/delete jobs.
EnqueueCUDJob(commands []command.CypherCommand)
// EnqueueReadJob enqueues read jobs.
EnqueueReadJob(commands []command.CypherCommand)
// EnqueueConstraintJobs enqueues constraint creation jobs.
EnqueueConstraintJobs()
// Ping checks database connectivity.
Ping(ctx context.Context) error
// Stop stops the service and worker pools.
Stop()
}
Interface defines general methods a service should implement.
Last modified: 28 January 2025