records

package
v0.0.0-...-b29ee48 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdrStatusCompletion

func AdrStatusCompletion(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)

AdrStatusCompletion is used to autocomplete cobra command

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 (AdrStatus) Colorized

func (e AdrStatus) Colorized() string

Colorized returns the AdrStatus as a colored string

func (*AdrStatus) Set

func (e *AdrStatus) Set(v string) error

Set must have pointer receiver so it doesn't change the value of a copy

func (*AdrStatus) String

func (e *AdrStatus) String() string

String is used both by fmt.Print and by Cobra in help text

func (*AdrStatus) Type

func (e *AdrStatus) Type() string

Type is only used in help 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 constraints.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