kpgx

package module
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(
	ctx context.Context,
	connectionString string,
	config ksql.Config,
) (db ksql.DB, err error)

New instantiates a new ksql.Client using pgx as the backend driver

func NewFromPgxPool

func NewFromPgxPool(pool *pgxpool.Pool) (db ksql.DB, err error)

NewFromPgxPool builds a ksql.DB from a *pgxpool.Pool instance

Types

type PGXAdapter

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

PGXAdapter adapts the sql.DB type to be compatible with the `DBAdapter` interface

func NewPGXAdapter

func NewPGXAdapter(db *pgxpool.Pool) PGXAdapter

NewPGXAdapter instantiates a new pgx adapter

func (PGXAdapter) BeginTx

func (p PGXAdapter) BeginTx(ctx context.Context) (ksql.Tx, error)

BeginTx implements the Tx interface

func (PGXAdapter) Close

func (p PGXAdapter) Close() error

Close implements the io.Closer interface

func (PGXAdapter) ExecContext

func (p PGXAdapter) ExecContext(ctx context.Context, query string, args ...interface{}) (ksql.Result, error)

ExecContext implements the DBAdapter interface

func (PGXAdapter) QueryContext

func (p PGXAdapter) QueryContext(ctx context.Context, query string, args ...interface{}) (ksql.Rows, error)

QueryContext implements the DBAdapter interface

type PGXResult

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

PGXResult is used to implement the DBAdapter interface and implements the Result interface

func (PGXResult) LastInsertId

func (p PGXResult) LastInsertId() (int64, error)

LastInsertId implements the Result interface

func (PGXResult) RowsAffected

func (p PGXResult) RowsAffected() (int64, error)

RowsAffected implements the Result interface

type PGXRows

type PGXRows struct {
	pgx.Rows
}

PGXRows implements the ksql.Rows interface and is used to help the PGXAdapter to implement the ksql.DBAdapter interface.

func (PGXRows) Close

func (p PGXRows) Close() error

Close implements the Rows interface

func (PGXRows) Columns

func (p PGXRows) Columns() ([]string, error)

Columns implements the Rows interface

func (PGXRows) Scan added in v1.4.10

func (p PGXRows) Scan(args ...interface{}) error

Scan implements the ksql.Rows interface

type PGXTx

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

PGXTx is used to implement the DBAdapter interface and implements the Tx interface

func (PGXTx) Commit

func (p PGXTx) Commit(ctx context.Context) error

Commit implements the Tx interface

func (PGXTx) ExecContext

func (p PGXTx) ExecContext(ctx context.Context, query string, args ...interface{}) (ksql.Result, error)

ExecContext implements the Tx interface

func (PGXTx) QueryContext

func (p PGXTx) QueryContext(ctx context.Context, query string, args ...interface{}) (ksql.Rows, error)

QueryContext implements the Tx interface

func (PGXTx) Rollback

func (p PGXTx) Rollback(ctx context.Context) error

Rollback implements the Tx interface

Jump to

Keyboard shortcuts

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