store

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package store is the service's PostgreSQL: the SDK's postgres provider with the service's schema (smtp) and migrations — its own, which also declare pg-outbox's table — plus the queries sqld generated and an hourly compaction of what expires.

Index

Constants

View Source
const Schema = "smtp"

Schema every table lives in.

Variables

This section is empty.

Functions

func New

func New(cfg postgres.Config) deps.Provider[*Store]

New is the provider: the postgres driver with the schema and the migrations.

Types

type Compactor

type Compactor struct {
	deps.Component
	// contains filtered or unexported fields
}

Compactor deletes expired idempotency keys and suppressions hourly.

func NewCompactor

func NewCompactor(parent deps.Scope, store deps.Dependency[*Store]) *Compactor

NewCompactor creates the compaction under parent.

func (*Compactor) Compact

func (c *Compactor) Compact(ctx context.Context) error

Compact runs one pass now.

type Store

type Store struct {
	*postgres.DB

	// Q runs on DB: inside the context's transaction, else the pool.
	Q *db.Queries
}

Store is the connection with the typed queries.

func (*Store) InTx

func (s *Store) InTx(ctx context.Context, fn func(ctx context.Context) error) error

InTx runs fn in one read-committed transaction; queries on Q join it.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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