postgres

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package postgres implements store.Store on PostgreSQL (14+).

To keep Workly's tables in a dedicated schema, create the schema and pass search_path in the connection URL, e.g. postgres://…/app?search_path=workly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	*sqlstore.Store
	// contains filtered or unexported fields
}

func Open

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

Open creates a connection pool. It does not connect until first use.

func (*Store) Close

func (s *Store) Close() error

func (*Store) ListenChanges added in v0.2.0

func (s *Store) ListenChanges(ctx context.Context, ready func(), fn func([]workspace.ID)) error

ListenChanges listens on a connection of its own, taken out of the pool: a pooled connection would carry the LISTEN to whoever uses it next.

func (*Store) Migrate

func (s *Store) Migrate(ctx context.Context) error

func (*Store) MigrationsPending

func (s *Store) MigrationsPending(ctx context.Context) (bool, error)

func (*Store) Ping

func (s *Store) Ping(ctx context.Context) error

func (*Store) PublishChanges added in v0.2.0

func (s *Store) PublishChanges(ctx context.Context, ws []workspace.ID) error

func (*Store) TryLead

func (s *Store) TryLead(ctx context.Context) (store.Leader, error)

TryLead takes the leader advisory lock on a dedicated connection, which also LISTENs for enqueue notifications. If the process dies the connection drops, Postgres releases the lock and another replica takes over.

Jump to

Keyboard shortcuts

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