store

package
v0.0.0-...-85b1164 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package store persists tasks in SQLite or Postgres. The Slack channel is the source of truth for what was said; this is the index for owners, status and the board.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reminder

type Reminder struct {
	Channel, TS, User string
	Due               time.Time
}

Reminder is a user's request to be reminded of a task at Due.

type Store

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

func Open

func Open(path string) (*Store, error)

Open opens or creates the SQLite file at path.

func OpenPostgres

func OpenPostgres(dsn string) (*Store, error)

OpenPostgres connects with a postgres:// URL or key=value DSN and creates the tables if missing. pgx waits forever for a connection by default, and every store call runs on the bot's single event goroutine, so a DSN without connect_timeout gets 10 s. HACK: queries themselves have no timeout; a server that stalls after connecting still blocks the bot. Upgrade path: pass a context with a deadline through every Store method.

func (*Store) Close

func (s *Store) Close() error

func (*Store) Delete

func (s *Store) Delete(channel, ts string) error

func (*Store) DeleteDone

func (s *Store) DeleteDone(channel string, cutoff time.Time) (int64, error)

DeleteDone removes a channel's done tasks whose last activity is before cutoff and returns how many went. Owners and checks cascade.

func (*Store) DeleteReminder

func (s *Store) DeleteReminder(r Reminder) error

func (*Store) DueReminders

func (s *Store) DueReminders(now time.Time) ([]Reminder, error)

DueReminders lists reminders due at or before now, oldest first.

func (*Store) Get

func (s *Store) Get(channel, ts string) (*task.Task, error)

Get returns nil, nil when the task does not exist.

func (*Store) KV

func (s *Store) KV(key string) (string, error)

KV returns "" when the key is unset.

func (*Store) Open

func (s *Store) Open(channel string) ([]task.Task, error)

Open lists a channel's tasks that are not done, oldest message first.

func (*Store) Save

func (s *Store) Save(t *task.Task) error

Save upserts the task and replaces its owner list and checklist ticks.

func (*Store) SetKV

func (s *Store) SetKV(key, value string) error

func (*Store) SetReminder

func (s *Store) SetReminder(r Reminder) error

SetReminder stores the reminder, replacing the user's earlier one on the same task.

Jump to

Keyboard shortcuts

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