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

workflow

package
v0.2.1 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: 7 Imported by: 0

Documentation

Overview

Package workflow provides workflow publishing functionality with simplified versioning.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrWorkflowNotFound is returned when a workflow is not found.
	ErrWorkflowNotFound = errors.New("workflow not found")
	ErrInvalidWorkflow  = errors.New("workflow validation failed")
)

Functions

This section is empty.

Types

type EventCatalog

type EventCatalog interface {
	Get(ctx context.Context, key string) (*models.EventDefinition, error)
}

type PublishingService

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

PublishingService handles workflow publishing operations with simplified versioning.

func NewPublishingService

func NewPublishingService(persistence persistence.Persistence, validator Validator, catalog EventCatalog) *PublishingService

NewPublishingService creates a new workflow publishing service.

func (*PublishingService) CreateDraftFromPublished

func (s *PublishingService) CreateDraftFromPublished(ctx context.Context, workflowGroupID string) (*models.Workflow, error)

CreateDraftFromPublished creates a draft copy from published version.

func (*PublishingService) GetCurrentWorkflow

func (s *PublishingService) GetCurrentWorkflow(ctx context.Context, workflowGroupID string) (*models.Workflow, error)

GetCurrentWorkflow returns the current version (published if exists, otherwise draft).

func (*PublishingService) GetDraftWorkflow

func (s *PublishingService) GetDraftWorkflow(ctx context.Context, workflowGroupID string) (*models.Workflow, error)

GetDraftWorkflow returns the draft version of a workflow group.

func (*PublishingService) GetPublishedWorkflow

func (s *PublishingService) GetPublishedWorkflow(ctx context.Context, workflowGroupID string) (*models.Workflow, error)

GetPublishedWorkflow returns the published version of a workflow group.

func (*PublishingService) PublishWorkflow

func (s *PublishingService) PublishWorkflow(ctx context.Context, workflowID string) (*models.Workflow, error)

PublishWorkflow changes a workflow's status to published and manages version history.

func (*PublishingService) UnpublishWorkflow added in v0.2.0

func (s *PublishingService) UnpublishWorkflow(ctx context.Context, workflowID string) (*models.Workflow, error)

type Repository

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

func NewRepository

func NewRepository(persistence persistence.Persistence) *Repository

NewRepository creates a new workflow repository.

func (*Repository) Create

func (r *Repository) Create(ctx context.Context, workflow *models.Workflow) (*models.Workflow, error)

Create adds a new workflow to the repository.

func (*Repository) Delete

func (r *Repository) Delete(ctx context.Context, workflowID string) error

Delete removes a workflow by its ID.

func (*Repository) FetchAll

func (r *Repository) FetchAll(ctx context.Context, tenantID string) ([]*models.Workflow, error)

FetchAll retrieves all workflows.

func (*Repository) FetchByID

func (r *Repository) FetchByID(ctx context.Context, id string) (*models.Workflow, error)

FetchByID retrieves a workflow by its ID.

func (*Repository) HealthCheck

func (r *Repository) HealthCheck(ctx context.Context) (string, bool)

HealthCheck checks the health of the persistence layer.

func (*Repository) Update

func (r *Repository) Update(
	ctx context.Context,
	workflowID string,
	workflow *models.Workflow,
) (*models.Workflow, error)

Update modifies an existing workflow by its ID.

type Validator

type Validator interface {
	Validate(ctx context.Context, workflow *models.Workflow) error
}

Jump to

Keyboard shortcuts

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