dbconn

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDataType

func GetDataType(ctx context.Context, inConn Conn, oid oid.Oid) (*pgtype.Type, error)

Types

type Conn

type Conn interface {
	ID() ID
	// Close closes the connection.
	Close(ctx context.Context) error
	// Clone creates a new Conn with the same underlying connections arguments.
	Clone(ctx context.Context) (Conn, error)
	// TypeMap returns a pgx typemap.
	// TODO: consider whether pgtype.Map is the right abstraction.
	TypeMap() *pgtype.Map
}

func Connect

func Connect(ctx context.Context, preferredID ID, connStr string) (Conn, error)

func TestOnlyCleanDatabase

func TestOnlyCleanDatabase(ctx context.Context, id ID, url string, dbName string) (Conn, error)

TestOnlyCleanDatabase returns a connection to a clean database. This is recommended for test use only

type ID

type ID string

type MySQLConn

type MySQLConn struct {
	*sql.DB
	// contains filtered or unexported fields
}

func ConnectMySQL

func ConnectMySQL(ctx context.Context, id ID, url string) (*MySQLConn, error)

func (*MySQLConn) Clone

func (c *MySQLConn) Clone(ctx context.Context) (Conn, error)

func (*MySQLConn) Close

func (c *MySQLConn) Close(ctx context.Context) error

func (*MySQLConn) ID

func (c *MySQLConn) ID() ID

func (*MySQLConn) TypeMap

func (c *MySQLConn) TypeMap() *pgtype.Map

type PGConn

type PGConn struct {
	*pgx.Conn
	// contains filtered or unexported fields
}

func NewPGConn added in v0.0.1

func NewPGConn(id ID, conn *pgx.Conn) *PGConn

func (*PGConn) Clone

func (c *PGConn) Clone(ctx context.Context) (Conn, error)

func (*PGConn) ID

func (c *PGConn) ID() ID

func (*PGConn) SQLDriver added in v0.0.1

func (c *PGConn) SQLDriver() interface{}

Jump to

Keyboard shortcuts

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