workflow

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Workflow

type Workflow struct {
	bun.BaseModel `bun:"table:workflows"`

	ID uuid.UUID `bun:",pk,type:uuid" json:"id"`
	// Slug is the human-facing workflow id — renameable, unlike ID.
	Slug string `bun:",notnull,unique" json:"slug"`
	// Version counts installed heads; it is 0 while only a draft exists.
	Version   int       `json:"version"`
	Spec      string    `json:"spec"`
	Draft     string    `json:"draft,omitempty"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Workflow is a registry row: the workflow's permanent identity plus its current spec. Spec holds the installed YAML head and Draft holds a proposed spec awaiting an explicit save. A workflow that was composed but never saved has an empty Spec.

func GetWorkflowBySlug

func GetWorkflowBySlug(ctx context.Context, db bun.IDB, slug string) (*Workflow, error)

func ListWorkflows

func ListWorkflows(ctx context.Context, db bun.IDB) ([]Workflow, error)

func (*Workflow) Delete

func (w *Workflow) Delete(ctx context.Context, db bun.IDB) error

func (*Workflow) Insert

func (w *Workflow) Insert(ctx context.Context, db bun.IDB) error

func (*Workflow) Update

func (w *Workflow) Update(ctx context.Context, db bun.IDB) error

func (*Workflow) Validate

func (w *Workflow) Validate() error

type WorkflowVersion

type WorkflowVersion struct {
	bun.BaseModel `bun:"table:workflow_versions"`

	ID         uuid.UUID `bun:",pk,type:uuid" json:"id"`
	WorkflowID uuid.UUID `bun:"type:uuid,notnull" json:"workflow_id"`
	Version    int       `bun:",notnull" json:"version"`
	Spec       string    `bun:",notnull" json:"spec"`
	CreatedAt  time.Time `json:"created_at"`
}

WorkflowVersion is one immutable entry in a workflow's history. Every installed head gets a row, so any past version can be inspected or restored. Rows outlive their workflow — deleting a workflow does not rewrite the past.

func GetWorkflowVersion

func GetWorkflowVersion(ctx context.Context, db bun.IDB, workflowID uuid.UUID, version int) (*WorkflowVersion, error)

func ListWorkflowVersions

func ListWorkflowVersions(ctx context.Context, db bun.IDB, workflowID uuid.UUID) ([]WorkflowVersion, error)

func (*WorkflowVersion) Insert

func (v *WorkflowVersion) Insert(ctx context.Context, db bun.IDB) error

func (*WorkflowVersion) Validate

func (v *WorkflowVersion) Validate() error

Jump to

Keyboard shortcuts

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