postgres

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package postgres opens an artifactweave store on PostgreSQL through pgx's database/sql adapter (decision 0004).

Index

Constants

This section is empty.

Variables

View Source
var Dialect = sqlcommon.Dialect{
	Name:              "postgres",
	Dollar:            true,
	ForUpdate:         "FOR UPDATE",
	Migrations:        sqlcommon.MustSub(migrationFS, "migrations"),
	IsUniqueViolation: IsUniqueViolation,
}

Dialect is PostgreSQL's sqlcommon.Dialect.

View Source
var ErrDSNRequired = errors.New("postgres: dsn is required")

ErrDSNRequired is returned by Open for an empty DSN.

Functions

func IsUniqueViolation

func IsUniqueViolation(err error) bool

IsUniqueViolation reports a PostgreSQL unique violation.

func Open

func Open(ctx context.Context, dsn string, o Options) (*sqlcommon.Store, error)

Open connects to dsn and migrates the schema.

Types

type Options

type Options struct {
	sqlcommon.Options
	// MaxOpenConns bounds the pool; 0 keeps the database/sql default.
	MaxOpenConns int
	// ConnMaxLifetime recycles connections; 0 keeps them.
	ConnMaxLifetime time.Duration
}

Options configures Open.

Jump to

Keyboard shortcuts

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