db

package
v0.7.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunMigrations

func RunMigrations(databaseURL string) error

RunMigrations runs all pending database migrations using goose.

Types

type AdvisoryLock added in v0.5.0

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

AdvisoryLock holds one session-level PostgreSQL advisory lock on a dedicated pool connection. Unlock must be called exactly once.

func (*AdvisoryLock) Unlock added in v0.5.0

func (l *AdvisoryLock) Unlock()

Unlock releases the advisory lock and its dedicated connection.

type DB

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

DB wraps a pgxpool.Pool.

func New

func New(ctx context.Context, databaseURL string) *DB

New creates a new DB, connecting to the given database URL.

func (*DB) AcquireAdvisoryLock added in v0.5.0

func (d *DB) AcquireAdvisoryLock(ctx context.Context, key string) (*AdvisoryLock, error)

AcquireAdvisoryLock serializes cross-replica work identified by key without holding row locks needed by callbacks performed during that work.

func (*DB) Close

func (d *DB) Close()

Close closes the connection pool.

func (*DB) Pool

func (d *DB) Pool() *pgxpool.Pool

Pool returns the underlying pool.

func (*DB) TryAcquireAdvisoryLock added in v0.5.0

func (d *DB) TryAcquireAdvisoryLock(ctx context.Context, key string) (*AdvisoryLock, bool, error)

TryAcquireAdvisoryLock obtains the lock without waiting.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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