slackrows

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: 16 Imported by: 1 module, 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 (
	TurnMe     = "me"
	TurnOthers = "others"
	TurnNobody = "nobody"
)

The values of FacetTurn.

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 FacetAge = "age"

FacetAge is since when a row has waited, as an RFC 3339 instant.

View Source
const FacetConversation = "conversation"

FacetConversation groups rows by channel or DM.

View Source
const FacetSituation = "situation"

FacetSituation is a row's kind.

View Source
const FacetTurn = "turn"

FacetTurn is whose turn a row's next step is: TurnMe, TurnOthers or TurnNobody; the strip's facet.

View Source
const FacetWaitsOn = "waits-on"

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

View Source
const FacetWhere = "where"

FacetWhere is a channel thread's channel name, without "#": the qualifier where:<name>. DMs have none.

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 Input

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

Input is what one unit's row derives from.

func (*Input) Bot added in v0.6.0

func (in *Input) Bot(id string) bool

Bot says whether the user cache knows id as a bot.

func (*Input) Conversation

func (in *Input) Conversation() store.ConversationRow

Conversation is the unit's conversation as stored.

func (*Input) Human added in v0.4.0

func (in *Input) Human(m store.MessageRow) bool

Human says whether m is a person's message, not a bot's, a deleted one or a hidden subtype.

func (*Input) Items

func (in *Input) Items() []items.Item

Items are the unit's items in the host's ledger.

func (*Input) Key

func (in *Input) Key() dslack.Key

Key is the unit's key.

func (*Input) Members added in v0.4.0

func (in *Input) Members() (store.MembersRow, bool)

Members are the stored members of the unit's conversation; false when they were never read.

func (*Input) Messages

func (in *Input) Messages() []store.MessageRow

Messages are the unit's stored messages, ascending.

func (*Input) State

func (in *Input) State() (store.ExtractionState, bool)

State is the unit's last extraction; false before any.

func (*Input) Viewer added in v0.4.0

func (in *Input) Viewer() string

Viewer is the viewer's Slack user id; "" when unknown.

type Kind

type Kind string

Kind is a Slack unit's situation kind: the extraction verdict.

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

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

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"`
	// Direct is a 1:1 DM between the viewer and one other person, not an app.
	Direct bool `json:"direct,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"`
}

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

func PayloadOf

func PayloadOf(r 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) 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]*Input, 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.

type Row

type Row struct {
	Unit    unit.Unit
	Link    string
	Label   string
	Title   string
	Kind    Kind
	Views   []string
	Facets  map[string][]string
	Summary Summary
	Items   []RowItem
	Payload json.RawMessage
}

Row is what a Slack unit shows: its situation, its open items and its payload, which the plugin reports as the unit's snapshot.

func Derive

func Derive(in *Input) Row

Derive is the row of in.

type RowItem

type RowItem struct {
	ID, Kind, Summary, State string
	WaitingOn                []string
	Since                    time.Time
}

RowItem is an open item a row shows.

type Source

type Source struct {
	DB *store.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
	// Items are the host ledger's items of units.
	Items func(ctx context.Context, units []unit.Unit) (map[unit.Unit][]items.Item, error)
	// Open are the host ledger's open items of every Slack unit.
	Open func(ctx context.Context) (map[unit.Unit][]items.Item, error)
}

Source is what the rows read: the store, the viewer the plugin learned and the host's items.

type Summary

type Summary struct {
	WaitsOn   string
	Since     time.Time
	Closed    bool
	OpenItems int
	Reason    string
	Line      string
}

Summary is what a row waits on and why.

Jump to

Keyboard shortcuts

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