postgres

package
v1.5.1-0...-475df33 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package postgres implements shared PostgreSQL-backed message storage.

Package postgres implements shared PostgreSQL-backed message storage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	ConnectionString       string
	MaxOpenConns           int
	MaxIdleConns           int
	ConnMaxLifetimeMinutes int
}

Options controls the PostgreSQL connection pool.

type Storage

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

Storage stores one user's rows in the shared PostgreSQL database.

func New

func New(username string, options Options) *Storage

func (*Storage) CanProvideMessages

func (s *Storage) CanProvideMessages() bool

func (*Storage) Close

func (s *Storage) Close()

func (*Storage) CountMessagesOfType

func (s *Storage) CountMessagesOfType(msgType model.MessageType) int

func (*Storage) CountMessagesOfTypePerDay

func (s *Storage) CountMessagesOfTypePerDay(msgType model.MessageType, sinceMs int64) []store.DayCount

func (*Storage) DatabaseSize

func (s *Storage) DatabaseSize() int64

DatabaseSize returns the size of PostgreSQL's current database. PostgreSQL storage is shared by users, so this is the total database size rather than a per-user estimate.

func (*Storage) DeleteChannel

func (s *Storage) DeleteChannel(network *model.Network, channel *model.Chan)

func (*Storage) DeleteMessages

func (s *Storage) DeleteMessages(req store.DeletionRequest) (int64, error)

func (*Storage) Enable

func (s *Storage) Enable() error

Enable opens the shared pool, verifies connectivity, and creates the provider schema if necessary.

func (*Storage) GetMessages

func (s *Storage) GetMessages(network *model.Network, channel *model.Chan, nextID func() int, limit int, before *store.MessageCursor) store.MessagePage

func (*Storage) ImportMessages

func (s *Storage) ImportMessages(records []store.MessageRecord) error

ImportMessages inserts records from one user's SQLite history. It is intentionally explicit and never deletes or mutates the source database.

func (*Storage) Index

func (s *Storage) Index(network *model.Network, channel *model.Chan, msg *model.Msg)

func (*Storage) IsEnabled

func (s *Storage) IsEnabled() bool

func (*Storage) Search

func (s *Storage) Search(query store.SearchQuery) (store.SearchResponse, error)

func (*Storage) Update

func (s *Storage) Update(network *model.Network, channel *model.Chan, msg *model.Msg)

Update persists mutable fields on an already-indexed message, currently reactions. Message IDs are client-local and are reassigned when history is loaded, so the stable IRC msgid identifies the row instead.

Jump to

Keyboard shortcuts

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