pgx

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptySlice = errors.New("kra: empty slice")

Functions

This section is empty.

Types

type Batch

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

func (*Batch) Batch

func (batch *Batch) Batch() *pgx.Batch

func (*Batch) Queue

func (batch *Batch) Queue(query string, args ...interface{}) error

type BatchResults

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

func (*BatchResults) BatchResults

func (batchResults *BatchResults) BatchResults() pgx.BatchResults

func (*BatchResults) Close

func (batchResults *BatchResults) Close() error

func (*BatchResults) Exec

func (batchResults *BatchResults) Exec() (pgconn.CommandTag, error)

func (*BatchResults) Query

func (batchResults *BatchResults) Query() (*Rows, error)

type Conn

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

func Connect

func Connect(ctx context.Context, connString string) (*Conn, error)

func NewConn

func NewConn(conn *pgx.Conn, core *kra.Core) *Conn

func (*Conn) Begin

func (conn *Conn) Begin(ctx context.Context) (*Tx, error)

func (*Conn) BeginFunc

func (conn *Conn) BeginFunc(ctx context.Context, f func(*Tx) error) error

func (*Conn) BeginTx

func (conn *Conn) BeginTx(ctx context.Context, txOptions pgx.TxOptions) (*Tx, error)

func (*Conn) BeginTxFunc

func (conn *Conn) BeginTxFunc(ctx context.Context, txOptions pgx.TxOptions, f func(*Tx) error) error

func (*Conn) Close

func (conn *Conn) Close(ctx context.Context) error

func (*Conn) Conn

func (conn *Conn) Conn() *pgx.Conn

func (*Conn) CopyFrom

func (conn *Conn) CopyFrom(ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)

func (*Conn) Exec

func (conn *Conn) Exec(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)

func (*Conn) Find

func (conn *Conn) Find(ctx context.Context, dest interface{}, query string, args ...interface{}) error

func (*Conn) FindAll

func (conn *Conn) FindAll(ctx context.Context, dest interface{}, query string, args ...interface{}) error

func (*Conn) Ping

func (conn *Conn) Ping(ctx context.Context) error

func (*Conn) Prepare

func (conn *Conn) Prepare(ctx context.Context, query string, examples ...interface{}) (*Stmt, error)

func (*Conn) Query

func (conn *Conn) Query(ctx context.Context, query string, args ...interface{}) (*Rows, error)

func (*Conn) SendBatch

func (conn *Conn) SendBatch(ctx context.Context, batch *Batch) *BatchResults

type CopyFromFn

type CopyFromFn func(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)

type DB

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

func NewDB

func NewDB(db *pgxpool.Pool, core *kra.Core) *DB

func Open

func Open(ctx context.Context, connString string) (*DB, error)

func OpenConfig

func OpenConfig(ctx context.Context, config *pgxpool.Config) (*DB, error)

func (*DB) Begin

func (db *DB) Begin(ctx context.Context) (*Tx, error)

func (*DB) BeginTx

func (db *DB) BeginTx(ctx context.Context, opts pgx.TxOptions) (*Tx, error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) CopyFrom

func (db *DB) CopyFrom(ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)

func (*DB) Exec

func (db *DB) Exec(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)

func (*DB) Find

func (db *DB) Find(ctx context.Context, dest interface{}, query string, args ...interface{}) error

func (*DB) FindAll

func (db *DB) FindAll(ctx context.Context, dest interface{}, query string, args ...interface{}) error

func (*DB) Ping

func (db *DB) Ping(ctx context.Context) error

func (*DB) Pool

func (db *DB) Pool() *pgxpool.Pool

func (*DB) Prepare

func (db *DB) Prepare(ctx context.Context, query string, examples ...interface{}) (*PooledStmt, error)

func (*DB) Query

func (db *DB) Query(ctx context.Context, query string, args ...interface{}) (*Rows, error)

func (*DB) SendBatch

func (db *DB) SendBatch(ctx context.Context, batch *Batch) *BatchResults

type ExecFn

type ExecFn func(context.Context, string, ...interface{}) (pgconn.CommandTag, error)

type Identifier

type Identifier pgx.Identifier

type PooledStmt

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

func (*PooledStmt) Close

func (stmt *PooledStmt) Close(ctx context.Context) error

func (*PooledStmt) Exec

func (stmt *PooledStmt) Exec(ctx context.Context, args ...interface{}) (pgconn.CommandTag, error)

func (*PooledStmt) Query

func (stmt *PooledStmt) Query(ctx context.Context, args ...interface{}) (*Rows, error)

func (*PooledStmt) Stmt

func (stmt *PooledStmt) Stmt() *pgconn.StatementDescription

type PrepareFn

type PrepareFn func(ctx context.Context, name, query string) (sd *pgconn.StatementDescription, err error)

type QueryFn

type QueryFn func(ctx context.Context, query string, args ...interface{}) (pgx.Rows, error)

type Rows

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

func NewRows

func NewRows(core *kra.Core, rows pgx.Rows) *Rows

func (*Rows) Close

func (rows *Rows) Close() error

func (*Rows) Err

func (rows *Rows) Err() error

func (*Rows) Next

func (rows *Rows) Next() bool

func (*Rows) Rows

func (rows *Rows) Rows() pgx.Rows

func (*Rows) Scan

func (rows *Rows) Scan(dest interface{}) error

type Stmt

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

func (*Stmt) Close

func (stmt *Stmt) Close(ctx context.Context) error

func (*Stmt) Exec

func (stmt *Stmt) Exec(ctx context.Context, args ...interface{}) (pgconn.CommandTag, error)

func (*Stmt) Query

func (stmt *Stmt) Query(ctx context.Context, args ...interface{}) (*Rows, error)

func (*Stmt) Stmt

func (stmt *Stmt) Stmt() *pgconn.StatementDescription

type Tx

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

func (*Tx) Begin

func (tx *Tx) Begin(ctx context.Context) (*Tx, error)

func (*Tx) BeginFunc

func (tx *Tx) BeginFunc(ctx context.Context, f func(*Tx) error) error

func (*Tx) Commit

func (tx *Tx) Commit(ctx context.Context) error

func (*Tx) CopyFrom

func (tx *Tx) CopyFrom(ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)

func (*Tx) Exec

func (tx *Tx) Exec(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)

func (*Tx) Find

func (tx *Tx) Find(ctx context.Context, dest interface{}, query string, args ...interface{}) error

func (*Tx) FindAll

func (tx *Tx) FindAll(ctx context.Context, dest interface{}, query string, args ...interface{}) error

func (*Tx) Prepare

func (tx *Tx) Prepare(ctx context.Context, query string, examples ...interface{}) (*Stmt, error)

func (*Tx) Query

func (tx *Tx) Query(ctx context.Context, query string, args ...interface{}) (*Rows, error)

func (*Tx) Rollback

func (tx *Tx) Rollback(ctx context.Context) error

func (*Tx) SendBatch

func (tx *Tx) SendBatch(ctx context.Context, batch *Batch) *BatchResults

func (*Tx) Tx

func (tx *Tx) Tx() pgx.Tx

Jump to

Keyboard shortcuts

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