notify

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 5 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 notify stores notifications for the human: rows in `notifications`, listed with `otag notify list` and acknowledged with `otag notify ack`. The daemon also shows new rows as macOS notifications (sent_at marks a row as handled by it).

Index

Constants

View Source
const (
	Info  = "info"
	Warn  = "warn"
	Error = "error"
)

Severities.

Variables

This section is empty.

Functions

func Ack

func Ack(ctx context.Context, q db.Querier, ids []int64) (int64, error)

Ack marks notifications read; no ids = every unread one. It returns how many changed.

func Add

func Add(ctx context.Context, q db.Querier, n New) (int64, error)

Add inserts a notification and returns its id.

func MarkSent

func MarkSent(ctx context.Context, q db.Querier, id int64, channel string) error

MarkSent records that the daemon handled a notification; channel says how (desktop | none).

func Unread

func Unread(ctx context.Context, q db.Querier) (int, error)

Unread counts notifications not acknowledged yet.

Types

type Filter

type Filter struct {
	All   bool // include acknowledged ones
	Limit int  // 0 = 50
}

Filter selects notifications for List.

type New

type New struct {
	ProjectID int64
	TaskID    string
	RunID     string
	Kind      string // e.g. run.crashed, run.stalled, run.unanswered, run.fallback, task.blocked
	Severity  string // default info
	Title     string
	Body      string
}

New describes a notification to add. ProjectID is required when TaskID or RunID is set.

type Notification

type Notification struct {
	ID        int64  `json:"id"`
	Project   string `json:"project,omitempty"`
	TaskID    string `json:"task_id,omitempty"`
	RunID     string `json:"run_id,omitempty"`
	Kind      string `json:"kind"`
	Severity  string `json:"severity"`
	Title     string `json:"title"`
	Body      string `json:"body,omitempty"`
	SentAt    string `json:"sent_at,omitempty"`
	ReadAt    string `json:"read_at,omitempty"`
	CreatedAt string `json:"created_at"`
}

Notification is a notifications row.

func List

func List(ctx context.Context, q db.Querier, f Filter) ([]Notification, error)

List returns notifications, newest first.

func Pending

func Pending(ctx context.Context, q db.Querier, limit int) ([]Notification, error)

Pending returns up to limit notifications the daemon has not handled (sent_at NULL), oldest first.

Jump to

Keyboard shortcuts

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