pgxblockysql

package module
v0.0.0-...-49c89df Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const SchemaName = "pgx"

SchemaName is the name of the driver.

Variables

This section is empty.

Functions

func OpenDB

func OpenDB(ctx context.Context, c pgx.ConnConfig, opts Options) (*blockysql.DB, error)

OpenDB returns a new bsql.DB backed by a *sql.DB.

Types

type DB

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

DB is the driver for the PostgreSQL database.

func (*DB) DB

func (d *DB) DB() *sql.DB

DB returns the underlying database/sql.DB.

func (*DB) Dialect

func (d *DB) Dialect() string

Dialect implements driver.DB

func (*DB) DriverName

func (d *DB) DriverName() string

DriverName implements driver.DB

func (*DB) ErrorCode

func (d *DB) ErrorCode(err error) bserr.Code

ErrorCode implements driver.DB.

func (*DB) ErrorColumn

func (d *DB) ErrorColumn(err error) string

ErrorColumn returns the column name of the given error if the driver doesn't support it, it should return an empty string.

func (*DB) ErrorConstraint

func (d *DB) ErrorConstraint(err error) string

ErrorConstraint returns the constraint name of the given error if the driver doesn't support it, it should return an empty string.

func (*DB) ErrorTable

func (d *DB) ErrorTable(err error) string

ErrorTable returns the table name of the given error if the driver doesn't support it, it should return an empty string.

func (*DB) HasErrorDetails

func (d *DB) HasErrorDetails() bool

HasErrorDetails returns true if the driver supports error details, such as column, table and constraint name.

type Options

type Options struct {
	// TraceOpts contains options for OpenCensus.
	TraceOpts []ocsql.TraceOption

	// OpenDBOpts contains options for configuring the database connection.
	OpenDBOpts []stdlib.OptionOpenDB
}

Options contains options for configuring the database connection.

type URLOpener

type URLOpener struct {
	// TraceOpts contains options for OpenCensus.
	TraceOpts []ocsql.TraceOption

	// OpenDBOpts contains options for the pgx driver.
	OpenDBOpts []stdlib.OptionOpenDB
}

URLOpener opens PostgreSQL URLs like "pgx://user:password@host/dbname?option=value". For details see https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING. This driver supports runtime configurable parameters as defined in https://www.postgresql.org/docs/current/runtime-config.html. I.e.:

  • search_path (string) - Sets the schema search order for names that are not schema-qualified.
  • timezone (string) - Sets the time zone for displaying and interpreting time stamps.

func (*URLOpener) OpenDBURL

func (o *URLOpener) OpenDBURL(ctx context.Context, u *url.URL) (*blockysql.DB, error)

OpenDBURL opens a new database connection for the given URL.

Jump to

Keyboard shortcuts

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