Documentation
¶
Overview ¶
Package store is Panelarr's PostgreSQL data layer: a pgx pool, the embedded goose migrations and the sqlc queries in package db.
Panelarr keeps everything inside its own database. It never changes settings of the PostgreSQL server and needs no superuser: the role only has to own the database (or have CREATE on it).
Index ¶
- type MigrationResult
- type MigrationStatus
- type Store
- func (s *Store) Close()
- func (s *Store) InTx(ctx context.Context, f func(q *db.Queries, tx pgx.Tx) error) error
- func (s *Store) Migrate(ctx context.Context) ([]MigrationResult, error)
- func (s *Store) MigrateDown(ctx context.Context) ([]MigrationResult, error)
- func (s *Store) Status(ctx context.Context) ([]MigrationStatus, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MigrationResult ¶
MigrationResult describes one applied migration.
type MigrationStatus ¶
MigrationStatus lists every migration and whether it is applied.
type Store ¶
Store wraps the connection pool and the generated queries.
func Open ¶
Open connects to the database at dsn (a PostgreSQL URL or key=value string) and checks the connection.
func (*Store) Migrate ¶
func (s *Store) Migrate(ctx context.Context) ([]MigrationResult, error)
Migrate applies all pending migrations. A Postgres advisory lock keeps several server instances from migrating at once.
func (*Store) MigrateDown ¶
func (s *Store) MigrateDown(ctx context.Context) ([]MigrationResult, error)
MigrateDown rolls back the latest migration.