composite

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package composite implements the Composite design pattern. It models classic Agile concepts such as Epics, Tasks, and SubTasks. SubTasks are leaf nodes, while Epics and Tasks are composites that can contain other components—either leaf nodes or nested composites. All components implement a shared set of interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run()

Types

type Composer

type Composer interface {
	AddChild(DetailsPresenter) Composer
}

Composer is implemented by composite components only that can contain child components.

type DetailsPresenter

type DetailsPresenter interface {
	ShowDetails() string
}

DetailsPresenter defines behavior for displaying component details, including nested ones.

type Epic

type Epic struct {
	WorkItem
	Children []DetailsPresenter
}

Epic represents the composite component.

func (*Epic) AddChild

func (e *Epic) AddChild(child DetailsPresenter) Composer

AddChild allows to add the children to the composite

func (*Epic) GetStatus

func (e *Epic) GetStatus() (humanize string)

GetStatus returns the human readable form of the component's status.

func (*Epic) NextStatus

func (e *Epic) NextStatus() StatusManager

NextStatus updates the status of the component to the next step in the pipeline.

func (*Epic) ShowDetails

func (e *Epic) ShowDetails() string

ShowDetails returns the aggregated details of the component and its sub-components.

type StatusManager

type StatusManager interface {
	GetStatus() string
	NextStatus() StatusManager
}

StatusManager defines behavior for retrieving and updating the workflow status of a component.

type SubTask

type SubTask struct {
	WorkItem
}

SubTask represents the leaf component.

func (*SubTask) GetStatus

func (st *SubTask) GetStatus() (humanize string)

GetStatus returns the human readable form of the component's status.

func (*SubTask) NextStatus

func (st *SubTask) NextStatus() StatusManager

NextStatus updates the status of the component to the next step in the pipeline.

func (*SubTask) ShowDetails

func (st *SubTask) ShowDetails() string

ShowDetails returns the details of the component.

type Task

type Task struct {
	WorkItem
	Children []DetailsPresenter
}

Task represents the composite component.

func (*Task) AddChild

func (t *Task) AddChild(child DetailsPresenter) Composer

AddChild allows to add the children to the composite

func (*Task) GetStatus

func (t *Task) GetStatus() (humanize string)

GetStatus returns the human readable form of the component's status.

func (*Task) NextStatus

func (t *Task) NextStatus() StatusManager

NextStatus updates the status of the component to the next step in the pipeline.

func (*Task) ShowDetails

func (t *Task) ShowDetails() string

ShowDetails returns the aggregated details of the component and its sub-components.

type WorkItem

type WorkItem struct {
	Title string
	// contains filtered or unexported fields
}

WorkItem holds the common fields shared by both leaf and composite components.

Jump to

Keyboard shortcuts

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