slackrows

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: 20 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 slackrows serves Slack units as read model rows: threads and DM segments with their extraction verdict and open items.

Index

Constants

View Source
const (
	KindNew           api.Kind = "new"
	KindWaitsOnViewer api.Kind = "waits_on_viewer"
	KindWaitsOnOthers api.Kind = "waits_on_others"
	KindNeedsClosure  api.Kind = "needs_closure"
	KindResolved      api.Kind = "resolved"
	KindFYI           api.Kind = "fyi"
)

The kinds of a Slack row: the extraction verdict, KindNew before any.

View Source
const ActiveFor = 14 * 24 * time.Hour

ActiveFor is how long after its last message an unwatched unit without open items keeps its row.

View Source
const FacetChannel = "channel"

FacetChannel is a channel thread's channel name, without "#": the qualifier channel:<name>.

View Source
const FacetConversation = "conversation"

FacetConversation groups rows by channel or DM.

View Source
const FacetWaitsOn = "waits-on"

FacetWaitsOn is the core facet of whom a row waits on.

View Source
const TitleRunes = 80

TitleRunes is the longest title a row takes from a message.

View Source
const ViewSlack = "slack"

ViewSlack lists the Slack units not closed.

Variables

This section is empty.

Functions

This section is empty.

Types

type LastHuman

type LastHuman struct {
	Who  items.Person `json:"who"`
	What string       `json:"what"`
	At   time.Time    `json:"at"`
	Link string       `json:"link,omitempty"`
}

LastHuman is the newest message a human other than the viewer wrote.

type Payload

type Payload struct {
	Conversation string `json:"conversation"`
	// Channel is the channel's name without "#"; "" for a DM.
	Channel string `json:"channel,omitempty"`
	DM      bool   `json:"dm,omitempty"`
	// With are the other people of a DM, by name.
	With  []string `json:"with,omitempty"`
	Topic string   `json:"topic,omitempty"`
	// Verdict is the last extraction's; "" before any.
	Verdict         string         `json:"verdict,omitempty"`
	StartedByViewer bool           `json:"started_by_viewer,omitempty"`
	ClosurePosted   bool           `json:"closure_posted,omitempty"`
	Followed        bool           `json:"followed,omitempty"`
	Replies         int            `json:"replies"`
	LastActivity    time.Time      `json:"last_activity,omitzero"`
	LastHuman       *LastHuman     `json:"last_human,omitempty"`
	WaitsOn         []items.Person `json:"waits_on,omitempty"`
	Viewer          string         `json:"viewer,omitempty"`
	// Turns are the loop's turns on the unit; nil when it had none.
	Turns *api.TurnFacts `json:"turns,omitempty"`
	// Next is sorted by At and holds only future instants.
	Next []api.Upcoming `json:"next,omitempty"`
}

Payload is a Slack row's provider part: what the card reads beyond the generic row.

func PayloadOf

func PayloadOf(r api.Row) (Payload, bool)

PayloadOf decodes a Slack row's payload; false for another provider or none.

type Provider

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

Provider is the Slack rows provider.

func New

func New(s Source) *Provider

func (*Provider) Derive

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

func (*Provider) Facets

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

func (*Provider) Listed

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

Listed are the threads and open DM segments of the objects watched or active within ActiveFor, and every Slack unit with an open item.

func (*Provider) Load

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

Load reads each unit's conversation, object, messages, extraction state, items and the users they name. A unit with neither a message nor an extraction state has no row.

func (*Provider) Provider

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

func (*Provider) Situations

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

func (*Provider) Views

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

type Source

type Source struct {
	DB *sqlite.DB
	// Viewer is the logged-in team and user; an error is an unknown viewer.
	Viewer func(ctx context.Context) (team, user string, err error)
	// Now nil is time.Now.
	Now func() time.Time
	// Activity nil shows no activity.
	Activity readmodel.Activities
}

Source is what the rows read: the store and the viewer the plugin learned.

Jump to

Keyboard shortcuts

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