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 ¶
- type Reminder
- type Store
- func (s *Store) Close() error
- func (s *Store) Delete(channel, ts string) error
- func (s *Store) DeleteDone(channel string, cutoff time.Time) (int64, error)
- func (s *Store) DeleteReminder(r Reminder) error
- func (s *Store) DueReminders(now time.Time) ([]Reminder, error)
- func (s *Store) Get(channel, ts string) (*task.Task, error)
- func (s *Store) KV(key string) (string, error)
- func (s *Store) Open(channel string) ([]task.Task, error)
- func (s *Store) Save(t *task.Task) error
- func (s *Store) SetKV(key, value string) error
- func (s *Store) SetReminder(r Reminder) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func OpenPostgres ¶
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) DeleteDone ¶
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 (*Store) DueReminders ¶
DueReminders lists reminders due at or before now, oldest first.
func (*Store) SetReminder ¶
SetReminder stores the reminder, replacing the user's earlier one on the same task.