postgres

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
	QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
	QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}

type Migrator

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

func (*Migrator) CreateMigrationTable

func (m *Migrator) CreateMigrationTable(ctx context.Context, db migrator.DB) error

func (*Migrator) CreateSchema

func (m *Migrator) CreateSchema(ctx context.Context, db migrator.DB) error

func (*Migrator) InsertMigrationRow

func (m *Migrator) InsertMigrationRow(ctx context.Context, db migrator.DB, version uint32, fileName, sha string) error

func (*Migrator) Migrations

func (m *Migrator) Migrations() map[string]string

func (*Migrator) SelectLock

func (m *Migrator) SelectLock(ctx context.Context, db migrator.DB) error

func (*Migrator) SelectMaxMigration

func (m *Migrator) SelectMaxMigration(ctx context.Context, db migrator.DB) *sql.Row

func (*Migrator) SelectUnlock

func (m *Migrator) SelectUnlock(ctx context.Context, db migrator.DB) error

type Repository

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

func New

func New(ctx context.Context, db DB, schema, prefix string) (*Repository, error)

func (*Repository) DeleteLeases

func (s *Repository) DeleteLeases(ctx context.Context, clientID string) error

func (*Repository) GetAndRefreshLeases

func (s *Repository) GetAndRefreshLeases(ctx context.Context, names []string, clientID string, ttl time.Duration) ([]lease.Info, error)

func (*Repository) InsertLease

func (s *Repository) InsertLease(ctx context.Context, clientID string, leaseName string, value int, ttl time.Duration, status lease.Status) error

func (*Repository) SetLeaseStatus

func (s *Repository) SetLeaseStatus(ctx context.Context, clientID string, leaseName string, value int, status lease.Status) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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