records

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AdrStatusDescriptions = map[AdrStatus]string{
	UNKNOWN:    "status is not determined",
	PROPOSED:   "the record has been proposed but is not accepted yet by stakeholders",
	ACCEPTED:   "the record has been accepted by stakeholders",
	DEPRECATED: "the decision record is deprecated and no longer applies",
	SUPERSEDED: "the decision record has been superseded by a new one",
	OBSERVED:   "the decision was observed after the fact",
}

AdrStatusDescriptions documents the meaning of each status.

AdrStatuses lists every allowed status in display order.

Functions

func AllowedStatuses

func AllowedStatuses() string

AllowedStatuses returns the allowed statuses formatted for help/error messages, e.g. `"unknown", "proposed", "accepted", "deprecated", "superseded" or "observed"`.

func MarshalYAML

func MarshalYAML(v any) ([]byte, error)

Types

type AdrData

type AdrData struct {
	ID             string      `yaml:"id"`
	Title          string      `yaml:"title"`
	Author         string      `yaml:"author"`
	Status         AdrStatus   `yaml:"status"`
	CreationDate   time.Time   `yaml:"creation_date" mapstructure:"creation_date"`
	LastUpdateDate time.Time   `yaml:"last_update_date" mapstructure:"last_update_date"`
	Tags           Set[string] `yaml:"tags,omitempty"`
	Superseders    Set[string] `yaml:"superseders,omitempty"`

	Name string `yaml:"-"`
	Body string `yaml:"-"`
}

func (AdrData) ToRow

func (a AdrData) ToRow() []string

type AdrStatus

type AdrStatus string

AdrStatus type

const (
	UNKNOWN    AdrStatus = "unknown"
	PROPOSED   AdrStatus = "proposed"
	ACCEPTED   AdrStatus = "accepted"
	DEPRECATED AdrStatus = "deprecated"
	SUPERSEDED AdrStatus = "superseded"
	OBSERVED   AdrStatus = "observed"
)

ADR status enums

func ParseStatus

func ParseStatus(v string) (AdrStatus, error)

ParseStatus validates a raw value and returns the matching AdrStatus.

func (AdrStatus) Colorized

func (e AdrStatus) Colorized() string

Colorized returns the AdrStatus as a colored string

func (AdrStatus) String

func (e AdrStatus) String() string

String is used by fmt.Print and everywhere a status is rendered as text.

type Service

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

func NewService

func NewService() (*Service, error)

func (Service) CreateRecord

func (s Service) CreateRecord(title string, record AdrData) error

func (Service) GetRecord

func (s Service) GetRecord(recordID string) (AdrData, bool)

func (Service) GetRecords

func (s Service) GetRecords() []AdrData

func (Service) UpdateRecord

func (s Service) UpdateRecord(record AdrData) error

type Set

type Set[T cmp.Ordered] map[T]bool

func (*Set[T]) Append

func (s *Set[T]) Append(elements ...T)

func (Set[T]) MarshalYAML

func (s Set[T]) MarshalYAML() (interface{}, error)

func (Set[T]) Remove

func (s Set[T]) Remove(elements ...T)

func (*Set[T]) Set

func (s *Set[T]) Set(elements ...T)

func (Set[T]) ToSlice

func (s Set[T]) ToSlice() []T

func (*Set[T]) UnmarshalYAML

func (s *Set[T]) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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