Help us shape the future of Go! Take the 2026 Go Developer Survey

postgres

package
v0.1.6 Latest Latest
Warning

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

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

Documentation

Overview

Package postgres owns a single server's PostgreSQL connections and paired schemas. The owned connection executes every write and never reconnects.

Index

Constants

View Source
const AccountSchemaVersion = 1
View Source
const SchemaVersion = 1

Variables

View Source
var AccountSchema string
View Source
var DataSchema string

Functions

func Connect

func Connect(dsn string) (*sql.DB, error)

Configuration errors are intentionally fixed: driver errors may contain DSNs.

func Inspect

func Inspect(ctx context.Context, db *sql.DB) (map[string]string, error)

Inspect describes actual physical objects, including constraints, indexes, views and unexpected triggers/functions. It never writes or repairs storage.

Types

type Store

type Store struct {
	Reader *sql.DB
	Writer sync.Mutex
	// contains filtered or unexported fields
}

func Open

func Open(parent context.Context, dsn string) (*Store, error)

func (*Store) BeginWrite

func (s *Store) BeginWrite(ctx context.Context) (*sql.Tx, error)

func (*Store) Check

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

func (*Store) Close

func (s *Store) Close() error

func (*Store) Context

func (s *Store) Context() context.Context

func (*Store) Ready

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

func (*Store) SQL

func (s *Store) SQL() *sql.DB

func (*Store) WriteTransaction

func (s *Store) WriteTransaction(ctx context.Context, operation func(*sql.Tx) error) error

Directories

Path Synopsis
Package testdb creates isolated disposable PostgreSQL databases for real tests.
Package testdb creates isolated disposable PostgreSQL databases for real tests.

Jump to

Keyboard shortcuts

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