fakesource

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 11 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 fakesource is a source plugin's reports of chat threads, for tests: each thread is a snapshot, served as rows through the host's readmodel.Reported, as a plugin's units are. Nothing registers it.

Index

Constants

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

The kinds of a thread.

View Source
const FacetWhere = "where"

FacetWhere is the thread plugin's where 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 t's row, as the host derives it from t's snapshot.

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 Source

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

Source holds the threads' last reports.

func New

func New(threads ...Thread) *Source

New is a Source that reported threads.

func (*Source) Reported

func (s *Source) Reported(_ context.Context, units []unit.Unit) (map[unit.Unit]src.Snapshot, error)

func (*Source) Rows

func (s *Source) Rows() *readmodel.Reported

Rows serves the threads as the host serves a plugin's units.

func (*Source) Set

func (s *Source) Set(t Thread)

Set reports t again, replacing its last report.

func (*Source) Units

func (s *Source) Units(_ context.Context, p unit.ProviderID) ([]unit.Unit, error)

type Thread

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

Thread is one thread as its plugin knows it.

func (Thread) Snapshot

func (t Thread) Snapshot() src.Snapshot

Snapshot is the thread as its plugin reports it.

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