postgres

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

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
}

Store implements incident.IncidentStore against PostgreSQL.

func NewStore

func NewStore(pool *pgxpool.Pool) *Store

NewStore creates a Store backed by the given pool.

func (*Store) AddComment

func (s *Store) AddComment(incidentID string, comment incident.Comment) error

AddComment inserts a comment for the given incident.

func (*Store) FindActiveByKey

func (s *Store) FindActiveByKey(ctx context.Context, service, deployID string, since time.Time) (*incident.Incident, error)

FindActiveByKey returns the most recent active or acknowledged incident matching the given service, optional deploy ID, and recency threshold.

func (*Store) Get

func (s *Store) Get(ctx context.Context, id string) (*incident.Incident, error)

Get returns the incident with the given ID. Returns incident.ErrNotFound if no row exists.

func (*Store) GetComments

func (s *Store) GetComments(incidentID string) ([]incident.Comment, error)

GetComments returns all comments for the given incident, ordered by creation time.

func (*Store) List

func (s *Store) List(ctx context.Context, filter incident.IncidentFilter) ([]incident.Incident, error)

List returns incidents matching the given filter, ordered by first_seen DESC.

func (*Store) Save

func (s *Store) Save(ctx context.Context, inc *incident.Incident) error

Save inserts an Incident into the database. If inc.ID is empty, a new UUID is generated and written back to inc.ID.

func (*Store) Update

func (s *Store) Update(ctx context.Context, inc *incident.Incident) error

Update replaces all fields of the incident with the given ID.

Jump to

Keyboard shortcuts

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