dbconn

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 12 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 Config

type Config struct {
	Source string
	Target string
}

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.
	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 FakeConn

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

func MakeFakeConn

func MakeFakeConn(id ID) FakeConn

func (FakeConn) Clone

func (f FakeConn) Clone(ctx context.Context) (Conn, error)

func (FakeConn) Close

func (f FakeConn) Close(ctx context.Context) error

func (FakeConn) ID

func (f FakeConn) ID() ID

func (FakeConn) TypeMap

func (f FakeConn) TypeMap() *pgtype.Map

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 OrderedConns

type OrderedConns [2]Conn

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, version string) *PGConn

func (*PGConn) Clone

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

func (*PGConn) ID

func (c *PGConn) ID() ID

func (*PGConn) IsCockroach

func (c *PGConn) IsCockroach() bool

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