Documentation
¶
Overview ¶
Package postgres implements shared PostgreSQL-backed message storage.
Package postgres implements shared PostgreSQL-backed message storage.
Index ¶
- type Options
- type Storage
- func (s *Storage) CanProvideMessages() bool
- func (s *Storage) Close()
- func (s *Storage) CountMessagesOfType(msgType model.MessageType) int
- func (s *Storage) CountMessagesOfTypePerDay(msgType model.MessageType, sinceMs int64) []store.DayCount
- func (s *Storage) DatabaseSize() int64
- func (s *Storage) DeleteChannel(network *model.Network, channel *model.Chan)
- func (s *Storage) DeleteMessages(req store.DeletionRequest) (int64, error)
- func (s *Storage) Enable() error
- func (s *Storage) GetMessages(network *model.Network, channel *model.Chan, nextID func() int, limit int, ...) store.MessagePage
- func (s *Storage) ImportMessages(records []store.MessageRecord) error
- func (s *Storage) Index(network *model.Network, channel *model.Chan, msg *model.Msg)
- func (s *Storage) IsEnabled() bool
- func (s *Storage) Search(query store.SearchQuery) (store.SearchResponse, error)
- func (s *Storage) Update(network *model.Network, channel *model.Chan, msg *model.Msg)
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 (*Storage) CanProvideMessages ¶
func (*Storage) CountMessagesOfType ¶
func (s *Storage) CountMessagesOfType(msgType model.MessageType) int
func (*Storage) CountMessagesOfTypePerDay ¶
func (*Storage) DatabaseSize ¶
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 (*Storage) DeleteMessages ¶
func (s *Storage) DeleteMessages(req store.DeletionRequest) (int64, error)
func (*Storage) Enable ¶
Enable opens the shared pool, verifies connectivity, and creates the provider schema if necessary.
func (*Storage) GetMessages ¶
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) Search ¶
func (s *Storage) Search(query store.SearchQuery) (store.SearchResponse, error)