postgres

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package postgres implements store.Store on PostgreSQL via pgx (PRD §2).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MigrateDown

func MigrateDown(dsn string) error

MigrateDown rolls back the most recent migration.

func MigrateUp

func MigrateUp(dsn string) error

MigrateUp applies all pending migrations. ErrNoChange is treated as success.

Types

type Store

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

Store is the PostgreSQL-backed implementation of store.Store.

func Open

func Open(ctx context.Context, dsn string) (*Store, error)

Open connects to Postgres and verifies connectivity.

func (*Store) BaselineVersion

func (s *Store) BaselineVersion(ctx context.Context) (model.ContractVersion, error)

func (*Store) Close

func (s *Store) Close()

Close releases the connection pool.

func (*Store) DSN

func (s *Store) DSN() string

DSN returns the configured connection string.

func (*Store) GetContractVersion

func (s *Store) GetContractVersion(ctx context.Context, id string) (model.ContractVersion, error)

func (*Store) LatestVersion

func (s *Store) LatestVersion(ctx context.Context) (model.ContractVersion, error)

func (*Store) ListChangeEvents

func (s *Store) ListChangeEvents(ctx context.Context, since time.Time) ([]model.ChangeEvent, error)

func (*Store) ProbeHistory

func (s *Store) ProbeHistory(ctx context.Context, consumerID string, limit int) ([]model.ProbeResult, error)

func (*Store) SaveChangeEvents

func (s *Store) SaveChangeEvents(ctx context.Context, events []model.ChangeEvent) error

func (*Store) SaveContractVersion

func (s *Store) SaveContractVersion(ctx context.Context, v model.ContractVersion) error

func (*Store) SaveProbeResults

func (s *Store) SaveProbeResults(ctx context.Context, results []model.ProbeResult) error

Jump to

Keyboard shortcuts

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