postgres

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package postgres provides a persistence Driver backed by PostgreSQL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.18.0

type Config struct {
	// Pool is the pgxpool configuration used to establish connections.
	Pool *pgxpool.Config
}

Config holds the configuration for a PostgreSQL persistence driver.

func FromURL added in v0.18.0

func FromURL(_ context.Context, u *url.URL) (*Config, error)

FromURL returns a *Config for the given postgres:// or postgresql:// *url.URL. See ParseURL for the URL format.

func ParseURL added in v0.18.0

func ParseURL(ctx context.Context, u string) (*Config, error)

ParseURL returns a *Config for the given postgres:// or postgresql:// URL string.

URL format:

postgres://[user:password@]host[:port]/database[?parameters]

Pool and connection settings can be configured via URL parameters. See pgxpool.ParseConfig for the full list of supported parameters.

func (*Config) NewDriver added in v0.18.0

func (c *Config) NewDriver(ctx context.Context) (*Driver, error)

NewDriver creates a Driver backed by a new connection pool.

type Driver added in v0.18.0

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

Driver is a persistence driver backed by PostgreSQL.

func New added in v0.18.0

func New(db *sql.DB) *Driver

New returns a Driver that uses the given *sql.DB. The caller retains ownership of db; Driver.Close does not close it.

func (*Driver) Close added in v0.18.0

func (d *Driver) Close() error

Close closes the underlying connection pool.

func (*Driver) JournalStore added in v0.18.0

func (d *Driver) JournalStore() journal.BinaryStore

JournalStore returns a journal store backed by PostgreSQL.

func (*Driver) KVStore added in v0.18.0

func (d *Driver) KVStore() kv.BinaryStore

KVStore returns a key/value store backed by PostgreSQL.

func (*Driver) SetStore added in v0.18.0

func (d *Driver) SetStore() set.BinaryStore

SetStore returns a set store backed by PostgreSQL.

Directories

Path Synopsis
internal
bigint
Package bigint provides helpers to "bias encode" uint64 values as signed PostgreSQL int8 (bigint) values.
Package bigint provides helpers to "bias encode" uint64 values as signed PostgreSQL int8 (bigint) values.
pgerror
Package pgerror provides utilities for working with PostgreSQL errors.
Package pgerror provides utilities for working with PostgreSQL errors.
pgtest
Package pgtest provides utilities for testing code that interacts with PostgreSQL databases.
Package pgtest provides utilities for testing code that interacts with PostgreSQL databases.
Package pgjournal provides an implementation of journal.BinaryStore that persists to a PostgreSQL database.
Package pgjournal provides an implementation of journal.BinaryStore that persists to a PostgreSQL database.
Package pgkv provides an implementation of kv.BinaryStore that persists to a PostgreSQL database.
Package pgkv provides an implementation of kv.BinaryStore that persists to a PostgreSQL database.
Package pgset provides an implementation of set.BinaryStore that persists to a PostgreSQL database.
Package pgset provides an implementation of set.BinaryStore that persists to a PostgreSQL database.

Jump to

Keyboard shortcuts

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