fakethread

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 10 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 fakethread is a provider of chat threads for tests: a unit codec and a rows provider whose rows carry no payload. Nothing registers it.

Index

Constants

View Source
const (
	KindWaiting  api.Kind = "waiting"
	KindAnswered api.Kind = "answered"
)

The kinds of a thread.

View Source
const FacetChannel = "channel"

FacetChannel is the thread provider's own facet.

View Source
const ID unit.ProviderID = "thread"

Variables

View Source
var Codec = unit.OpaqueCodec{ID: ID}

Codec accepts any non-blank one-line key.

Functions

func Row

func Row(t Thread) api.Row

Row is the thread's row.

Types

type Payload

type Payload struct{ Key string }

Payload is a fake thread as a turn reads it.

func (Payload) Arg

func (p Payload) Arg() string

func (Payload) Fact

func (p Payload) Fact(name string) (any, bool)

func (Payload) Unit

func (p Payload) Unit() unit.Unit

func (Payload) Wording

func (p Payload) Wording() turn.Wording

type Payloads

type Payloads struct{}

Payloads reads a fake thread's turn payload from its unit alone.

func (Payloads) Payload

func (Payloads) Payload(_ context.Context, r turn.Request) (turn.Payload, error)

type Provider

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

Provider serves a row per thread it holds.

func New

func New(threads ...Thread) *Provider

func (*Provider) Derive

func (p *Provider) Derive(_ readmodel.Base, in any, _ time.Time) (api.Row, error)

func (*Provider) Facets

func (p *Provider) Facets() []api.FacetSpec

func (*Provider) Listed

func (p *Provider) Listed(context.Context) ([]unit.Unit, error)

func (*Provider) Load

func (p *Provider) Load(_ context.Context, units []unit.Unit) (map[unit.Unit]any, error)

func (*Provider) Provider

func (p *Provider) Provider() unit.ProviderID

func (*Provider) Set

func (p *Provider) Set(t Thread)

Set adds or replaces a thread.

func (*Provider) Situations

func (p *Provider) Situations() []api.SituationSpec

func (*Provider) Views

func (p *Provider) Views() []api.ViewSpec

type Thread

type Thread struct {
	Key, Channel, Title string
	Kind                api.Kind
	WaitsOn, Reason     string
	Since               time.Time
	Stalled             bool
}

Thread is one thread's row input.

func (Thread) Unit

func (t Thread) Unit() unit.Unit

Unit is the thread's unit.

Jump to

Keyboard shortcuts

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