pgx

package module
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConnBusy = errors.New("conn is busy")

ErrConnBusy occurs when the connection is busy (for example, in the middle of reading query results) and another action is attempts.

View Source
var ErrDeadConn = errors.New("conn is dead")

ErrDeadConn occurs on an attempt to use a dead connection

View Source
var ErrInvalidLogLevel = pgx.ErrInvalidLogLevel

ErrInvalidLogLevel occurs on attempt to set an invalid log level.

View Source
var ErrNoRows = pgx.ErrNoRows

ErrNoRows occurs when rows are expected but none are returned.

View Source
var ErrNotificationTimeout = errors.New("notification timeout")

ErrNotificationTimeout occurs when WaitForNotification times out.

View Source
var ErrTLSRefused = errors.New("server refused TLS connection")

ErrTLSRefused occurs when the connection attempt requires TLS and the PostgreSQL server refuses to use TLS

Functions

This section is empty.

Types

type CommandTag

type CommandTag pgconn.CommandTag

CommandTag is the result of an Exec function

type CopyFromSource

type CopyFromSource pgx.CopyFromSource

CopyFromSource is the interface used by *Conn.CopyFrom as the source for copy data.

func CopyFromRows

func CopyFromRows(rows [][]interface{}) CopyFromSource

CopyFromRows returns a CopyFromSource interface over the provided rows slice making it usable by *Conn.CopyFrom.

type Identifier

type Identifier pgx.Identifier

Identifier a PostgreSQL identifier or name. Identifiers can be composed of multiple parts such as ["schema", "table"] or ["table", "column"].

type Mocker

type Mocker interface {
	PGXer
	QueriesRun() []onedb.MethodsRun
	SaveMethodCall(name string, arguments []interface{})
	VerifyNextCommand(t *testing.T, name string, expected ...interface{})
}

Mocker is the interface for mocking and includes all of the PGXer interface plus 3 methods to make testing easier

func NewMock

func NewMock(copyFromErr, execErr error, data ...interface{}) Mocker

NewMock returns a Mock PGX instance from a set of parameters

type Oid

type Oid uint32

Oid (Object Identifier Type) is, according to https://www.postgresql.org/docs/current/static/datatype-oid.html, used internally by PostgreSQL as a primary key for various system tables. It is currently implemented as an unsigned four-byte integer. Its definition can be found in src/include/postgres_ext.h in the PostgreSQL sources.

type PGXQuerier

type PGXQuerier interface {
	onedb.DBer
	// contains filtered or unexported methods
}

type PGXer

type PGXer interface {
	onedb.DBer
	// contains filtered or unexported methods
}

func NewPgx

func NewPgx(connectionString string) (PGXer, error)

NewPgx returns a PGX DBer instance from a connection string (either a URI or a DSN connection string)

func NewPgxFromURI deprecated added in v2.0.1

func NewPgxFromURI(uri string) (PGXer, error)

NewPgxFromURI returns a PGX DBer instance from a URI connection string

Deprecated: use NewPgx instead

type ProtocolError

type ProtocolError string

ProtocolError occurs when unexpected data is received from PostgreSQL

type Rower

type Rower interface {
	Err() error
	FieldDescriptions() []pgproto3.FieldDescription
	Next() bool
	onedb.Scanner
	Values() ([]interface{}, error)

	Columns() ([]string, error) // added
}

Rower is the public interface for all the capability found in a *pgx.Rows. Note that the Close method returns an error similar to how database/sql's rows Close returns and error

type Txer

type Txer interface {
	Commit() error
	Conn() *pgx.Conn
	Rollback() error
	Status() int8
	PGXQuerier
}

Jump to

Keyboard shortcuts

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