pgx

package module
Version: v0.0.0-...-8f40fab Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandTag

type CommandTag string

CommandTag is the result of an Exec function

type CopyFromSource

type CopyFromSource interface {
	// Next returns true if there is another row and makes the next row data
	// available to Values(). When there are no more rows available or an error
	// has occurred it returns false.
	Next() bool

	// Values returns the values for the current row.
	Values() ([]interface{}, error)

	// Err returns any error that has been encountered by the CopyFromSource. If
	// this is not nil *Conn.CopyFrom will abort the copy.
	Err() error
}

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 FieldDescription

type FieldDescription struct {
	Name            string
	Table           Oid
	AttributeNumber int16
	DataType        Oid
	DataTypeSize    int16
	DataTypeName    string
	Modifier        int32
	FormatCode      int16
}

type Identifier

type Identifier []string

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(server string, port uint16, username string, password string, database string) (PGXer, error)

NewPgx returns a PGX DBer instance from a set of parameters

func NewPgxFromURI

func NewPgxFromURI(uri string) (PGXer, error)

NewPgxFromURI returns a PGX DBer instance from a connection URI

type Rower

type Rower interface {
	AfterClose(f func(Rower)) // modified from pgxRower to use interface
	Close() error             // modified from pgxRower to match database/sql
	Conn() *pgx.Conn
	Err() error
	Fatal(err error)
	FieldDescriptions() []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
t or T : Toggle theme light dark auto
y or Y : Canonical URL