choices

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decidable

type Decidable interface {
	// ID returns the unique ID of this element
	ID() []byte

	// Accept accepts this element and changes its status to Accepted
	Accept() error

	// Reject rejects this element and changes its status to Rejected
	Reject() error

	// Status returns the current status
	Status() Status
}

Decidable represents an element that can be decided

type Status

type Status uint32

Status represents the status of a decision

const (
	// Unknown status
	Unknown Status = iota
	// Processing indicates the decision is being processed
	Processing
	// Rejected indicates the decision was rejected
	Rejected
	// Accepted indicates the decision was accepted
	Accepted
)

func (Status) Decided

func (s Status) Decided() bool

Decided returns true if the status is either Accepted or Rejected

func (Status) Fetched

func (s Status) Fetched() bool

Fetched returns true if the status is at least Processing

func (Status) IsAccepted added in v0.1.1

func (s Status) IsAccepted() bool

IsAccepted returns true if the status is Accepted

func (Status) IsProcessing added in v0.1.1

func (s Status) IsProcessing() bool

IsProcessing returns true if the status is Processing

func (Status) IsRejected added in v0.1.1

func (s Status) IsRejected() bool

IsRejected returns true if the status is Rejected

func (Status) IsUnknown added in v0.1.1

func (s Status) IsUnknown() bool

IsUnknown returns true if the status is Unknown

func (Status) String

func (s Status) String() string

String returns the string representation of the status

func (Status) Valid

func (s Status) Valid() bool

Valid returns true if the status is valid

type TestDecidable added in v0.1.1

type TestDecidable struct {
	IDVal     []byte
	StatusVal Status
}

TestDecidable is a test implementation of Decidable

func (*TestDecidable) Accept added in v0.1.1

func (d *TestDecidable) Accept() error

Accept implements Decidable

func (*TestDecidable) ID added in v0.1.1

func (d *TestDecidable) ID() []byte

ID implements Decidable

func (*TestDecidable) Reject added in v0.1.1

func (d *TestDecidable) Reject() error

Reject implements Decidable

func (*TestDecidable) Status added in v0.1.1

func (d *TestDecidable) Status() Status

Status implements Decidable

Jump to

Keyboard shortcuts

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