unit

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package unit names a unit of work by its provider and the provider's key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anchor

type Anchor struct {
	Unit      Unit      `json:"unit"`
	Ref       string    `json:"ref"` // slack "<conversation>/<ts>"; github "review:<id>", "comment:<id>", "commit:<oid>", "situation:<kind>"; "turn:<round>"; "row:<rev>"; "draft:<id>:<kind>"
	Permalink string    `json:"permalink,omitempty"`
	At        time.Time `json:"at,omitzero"`
}

Anchor is a plugin's opaque reference to a message or event inside a unit.

func (Anchor) Valid

func (a Anchor) Valid() error

Valid says why a is not an anchor: Ref non-blank, one line, at most 300 bytes; Unit non-zero.

type Codec

type Codec interface {
	Provider() ProviderID
	Valid(key string) error
}

Codec validates the keys of one provider.

type OpaqueCodec

type OpaqueCodec struct{ ID ProviderID }

OpaqueCodec accepts any non-blank key without a line break.

func (OpaqueCodec) Provider

func (c OpaqueCodec) Provider() ProviderID

func (OpaqueCodec) Valid

func (c OpaqueCodec) Valid(key string) error

type ProviderID

type ProviderID string
const (
	GitHub    ProviderID = "github"
	Session   ProviderID = "session"
	Workspace ProviderID = "workspace"
)

type Registry

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

func NewRegistry

func NewRegistry(cs ...Codec) *Registry

func (*Registry) Parse

func (r *Registry) Parse(provider, key string) (Unit, error)

func (*Registry) Providers

func (r *Registry) Providers() []ProviderID

type Unit

type Unit struct {
	Provider ProviderID `json:"provider"`
	Key      string     `json:"key"`
}

func (Unit) IsZero

func (u Unit) IsZero() bool

func (Unit) Label

func (u Unit) Label() string

Label names u as users read it: a pull request by its reference alone.

func (Unit) Less

func (u Unit) Less(o Unit) bool

Less orders by provider, then key; the sort order of every unit list.

func (Unit) String

func (u Unit) String() string

Jump to

Keyboard shortcuts

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