postgres

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package postgres provides a PostgreSQL Store implementation using Grove ORM.

Index

Constants

This section is empty.

Variables

View Source
var Migrations = migrate.NewGroup("herald")

Migrations is the grove migration group for the Herald store. It can be registered with the grove extension for orchestrated migration management (locking, version tracking, rollback support).

Functions

This section is empty.

Types

type Store

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

Store implements store.Store using PostgreSQL via Grove ORM.

func New

func New(db *grove.DB) *Store

New creates a new PostgreSQL store backed by Grove ORM.

func (*Store) Close

func (s *Store) Close() error

Close closes the database connection.

func (*Store) CountMessages

func (s *Store) CountMessages(ctx context.Context, appID string, since time.Time) ([]message.Count, error)

func (*Store) CreateMessage

func (s *Store) CreateMessage(ctx context.Context, m *message.Message) error

func (*Store) CreateNotification

func (s *Store) CreateNotification(ctx context.Context, n *inbox.Notification) error

func (*Store) CreateProvider

func (s *Store) CreateProvider(ctx context.Context, p *provider.Provider) error

func (*Store) CreateTemplate

func (s *Store) CreateTemplate(ctx context.Context, t *template.Template) error

func (*Store) CreateVersion

func (s *Store) CreateVersion(ctx context.Context, v *template.Version) error

func (*Store) DB

func (s *Store) DB() *grove.DB

DB returns the underlying grove database for direct access.

func (*Store) DeleteDevice

func (s *Store) DeleteDevice(ctx context.Context, appID, deviceID string) error

func (*Store) DeleteNotification

func (s *Store) DeleteNotification(ctx context.Context, notifID id.InboxID) error

func (*Store) DeletePreference

func (s *Store) DeletePreference(ctx context.Context, appID string, userID string) error

func (*Store) DeleteProvider

func (s *Store) DeleteProvider(ctx context.Context, providerID id.ProviderID) error

func (*Store) DeleteScopedConfig

func (s *Store) DeleteScopedConfig(ctx context.Context, configID id.ScopedConfigID) error

func (*Store) DeleteTemplate

func (s *Store) DeleteTemplate(ctx context.Context, templateID id.TemplateID) error

func (*Store) DeleteUserDevices

func (s *Store) DeleteUserDevices(ctx context.Context, appID, userID string) error

func (*Store) DeleteVersion

func (s *Store) DeleteVersion(ctx context.Context, versionID id.TemplateVersionID) error

func (*Store) GetDevice

func (s *Store) GetDevice(ctx context.Context, appID, deviceID string) (*device.Device, error)

func (*Store) GetMessage

func (s *Store) GetMessage(ctx context.Context, messageID id.MessageID) (*message.Message, error)

func (*Store) GetNotification

func (s *Store) GetNotification(ctx context.Context, notifID id.InboxID) (*inbox.Notification, error)

func (*Store) GetPreference

func (s *Store) GetPreference(ctx context.Context, appID string, userID string) (*preference.Preference, error)

func (*Store) GetProvider

func (s *Store) GetProvider(ctx context.Context, providerID id.ProviderID) (*provider.Provider, error)

func (*Store) GetScopedConfig

func (s *Store) GetScopedConfig(ctx context.Context, appID string, scopeType scope.ScopeType, scopeID string) (*scope.Config, error)

func (*Store) GetTemplate

func (s *Store) GetTemplate(ctx context.Context, templateID id.TemplateID) (*template.Template, error)

func (*Store) GetTemplateBySlug

func (s *Store) GetTemplateBySlug(ctx context.Context, appID string, slug string, channel string) (*template.Template, error)

func (*Store) GetVersion

func (s *Store) GetVersion(ctx context.Context, versionID id.TemplateVersionID) (*template.Version, error)

func (*Store) ListAllProviders

func (s *Store) ListAllProviders(ctx context.Context, appID string) ([]*provider.Provider, error)

func (*Store) ListDevices

func (s *Store) ListDevices(ctx context.Context, appID, userID string) ([]*device.Device, error)

func (*Store) ListMessages

func (s *Store) ListMessages(ctx context.Context, appID string, opts message.ListOptions) ([]*message.Message, error)

func (*Store) ListNotifications

func (s *Store) ListNotifications(ctx context.Context, appID string, userID string, limit, offset int) ([]*inbox.Notification, error)

func (*Store) ListProviders

func (s *Store) ListProviders(ctx context.Context, appID string, channel string) ([]*provider.Provider, error)

func (*Store) ListScopedConfigs

func (s *Store) ListScopedConfigs(ctx context.Context, appID string) ([]*scope.Config, error)

func (*Store) ListTemplates

func (s *Store) ListTemplates(ctx context.Context, appID string) ([]*template.Template, error)

func (*Store) ListTemplatesByChannel

func (s *Store) ListTemplatesByChannel(ctx context.Context, appID string, channel string) ([]*template.Template, error)

func (*Store) ListVersions

func (s *Store) ListVersions(ctx context.Context, templateID id.TemplateID) ([]*template.Version, error)

func (*Store) MarkAllRead

func (s *Store) MarkAllRead(ctx context.Context, appID string, userID string) error

func (*Store) MarkRead

func (s *Store) MarkRead(ctx context.Context, notifID id.InboxID) error

func (*Store) Migrate

func (s *Store) Migrate(ctx context.Context) error

Migrate creates the required tables and indexes using the grove orchestrator.

func (*Store) Ping

func (s *Store) Ping(ctx context.Context) error

Ping checks database connectivity.

func (*Store) RecordDelivery

func (s *Store) RecordDelivery(ctx context.Context, messageID id.MessageID, d message.Delivery) error

func (*Store) SaveDevice

func (s *Store) SaveDevice(ctx context.Context, d *device.Device) error

func (*Store) SetPreference

func (s *Store) SetPreference(ctx context.Context, p *preference.Preference) error

func (*Store) SetScopedConfig

func (s *Store) SetScopedConfig(ctx context.Context, cfg *scope.Config) error

func (*Store) UnreadCount

func (s *Store) UnreadCount(ctx context.Context, appID string, userID string) (int, error)

func (*Store) UpdateProvider

func (s *Store) UpdateProvider(ctx context.Context, p *provider.Provider) error

func (*Store) UpdateTemplate

func (s *Store) UpdateTemplate(ctx context.Context, t *template.Template) error

func (*Store) UpdateVersion

func (s *Store) UpdateVersion(ctx context.Context, v *template.Version) error

Jump to

Keyboard shortcuts

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