dbconn

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 15 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)

func RegisterTelemetry

func RegisterTelemetry(conns OrderedConns) 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

	IsCockroach() bool
	ConnStr() string
	Dialect() string
}

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) ConnStr

func (f FakeConn) ConnStr() string

func (FakeConn) Dialect

func (f FakeConn) Dialect() string

func (FakeConn) ID

func (f FakeConn) ID() ID

func (FakeConn) IsCockroach

func (f FakeConn) IsCockroach() bool

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, connStr 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) ConnStr

func (c *MySQLConn) ConnStr() string

func (*MySQLConn) Dialect

func (c *MySQLConn) Dialect() string

func (*MySQLConn) ID

func (c *MySQLConn) ID() ID

func (*MySQLConn) IsCockroach

func (c *MySQLConn) IsCockroach() bool

func (*MySQLConn) TypeMap

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

type OracleConn

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

func ConnectOracle

func ConnectOracle(ctx context.Context, id ID, connStr string) (*OracleConn, error)

func (*OracleConn) Clone

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

func (*OracleConn) Close

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

func (*OracleConn) ConnStr

func (c *OracleConn) ConnStr() string

func (*OracleConn) Dialect

func (c *OracleConn) Dialect() string

func (*OracleConn) ID

func (c *OracleConn) ID() ID

func (*OracleConn) IsCockroach

func (c *OracleConn) IsCockroach() bool

func (*OracleConn) TypeMap

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

type OrderedConns

type OrderedConns [2]Conn

type PGConn

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

func ConnectPG

func ConnectPG(ctx context.Context, id ID, connStr string) (*PGConn, error)

func ConnectPGConfig

func ConnectPGConfig(ctx context.Context, id ID, cfg *pgx.ConnConfig) (*PGConn, error)

func (*PGConn) Clone

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

func (*PGConn) ConnStr

func (c *PGConn) ConnStr() string

func (*PGConn) Dialect

func (c *PGConn) Dialect() string

func (*PGConn) ID

func (c *PGConn) ID() ID

func (*PGConn) IsCockroach

func (c *PGConn) IsCockroach() bool

Jump to

Keyboard shortcuts

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