Help us shape the future of Go! Take the 2026 Go Developer Survey

persistence

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package persistence provides data storage abstraction layer for workflows, nodes, and execution context.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExecutionNotFound       = errors.New("execution context not found")
	ErrEventDefinitionNotFound = errors.New("event definition not found")
	ErrNodeNotWaiting          = errors.New("node is not waiting")
	ErrResumeRefused           = errors.New("resume refused")
	ErrRemoteNodeTypeNotFound  = errors.New("remote node type not found")
	ErrWorkflowNotPublished    = errors.New("workflow is not published")
)

Functions

This section is empty.

Types

type ExecutionContextRepository

type ExecutionContextRepository interface {
	SaveExecutionContext(ctx context.Context, execCtx *models.ExecutionContext) error
	GetExecutionContext(ctx context.Context, executionID string) (*models.ExecutionContext, error)
	UpdateExecutionContext(ctx context.Context, execCtx *models.ExecutionContext) error
	GetExecutionsByWorkflow(ctx context.Context, workflowID string, limit int) ([]*models.ExecutionContext, error)
	GetExecutionsByStatus(ctx context.Context, status models.ExecutionStatus) ([]*models.ExecutionContext, error)
}

ExecutionContextRepository provides access to execution context data.

type Persistence

type Persistence interface {
	// Health check
	HealthCheck(ctx context.Context) error

	// Repository access
	WorkflowRepository() WorkflowRepository
	ExecutionContextRepository() ExecutionContextRepository

	Close(ctx context.Context) error
}

type WorkflowRepository

type WorkflowRepository interface {
	// Basic CRUD operations
	GetAll(ctx context.Context, tenantID string) ([]*models.Workflow, error)
	Save(ctx context.Context, workflow *models.Workflow) error
	GetByID(ctx context.Context, id string) (*models.Workflow, error)
	Delete(ctx context.Context, id string) error

	// Simplified versioning methods
	GetWorkflowVersions(ctx context.Context, workflowGroupID string) ([]*models.Workflow, error)
	GetCurrentWorkflow(ctx context.Context, workflowGroupID string) (*models.Workflow, error) // draft or published
	GetDraftWorkflow(ctx context.Context, workflowGroupID string) (*models.Workflow, error)   // draft only
	GetPublishedWorkflow(ctx context.Context, workflowGroupID string) (*models.Workflow, error)
	PublishWorkflow(ctx context.Context, workflowID string) error // NEW: handle publish logic in repo
	UnpublishWorkflow(ctx context.Context, workflowID string) error
	CreateDraftFromPublished(ctx context.Context, workflowGroupID string) (*models.Workflow, error) // NEW: create draft copy
}

WorkflowRepository provides workflow-related persistence operations.

Directories

Path Synopsis
Package postgresql provides PostgreSQL persistence implementation for workflows and triggers.
Package postgresql provides PostgreSQL persistence implementation for workflows and triggers.
Package sqlbase provides the base functionality for SQL database persistence.
Package sqlbase provides the base functionality for SQL database persistence.

Jump to

Keyboard shortcuts

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