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

postgres

package
v0.12.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

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

func Open

func Open(dsn string) (*Adapter, error)

Open connects to a PostgreSQL database using the given DSN. Accepts postgres:// or postgresql:// URL format.

func OpenReadonly added in v0.12.0

func OpenReadonly(dsn string) (*Adapter, error)

OpenReadonly connects with the session's default transaction marked read-only where the server supports it.

Whatever is at the far end — a server, or a pooler in front of one — refuses the connection outright if it will not take the parameter. Rather than turn a working DSN into a connection error, that case falls back to a plain connection: layer 2 is belt-and-braces, and the statement guard — which the caller wraps around this adapter — is unaffected either way.

func (*Adapter) Close

func (a *Adapter) Close() error

func (*Adapter) Columns added in v0.6.0

func (a *Adapter) Columns(ctx context.Context, tableName string) ([]string, error)

func (*Adapter) Query

func (a *Adapter) Query(ctx context.Context, query string) (db.QueryResult, error)

func (*Adapter) QuoteIdentifier added in v0.5.1

func (a *Adapter) QuoteIdentifier(name string) string

func (*Adapter) Schema

func (a *Adapter) Schema(ctx context.Context) (string, error)

func (*Adapter) Tables

func (a *Adapter) Tables(ctx context.Context) ([]string, error)

func (*Adapter) Type

func (a *Adapter) Type() string

Jump to

Keyboard shortcuts

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