pgx

package
v0.0.0-...-19d653a Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright 2022 taichi

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var ErrCopyFromSource = errors.New("kra: cannot use pgx.CopyFromSource as src, use the underlying object")
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 BatchHook

type BatchHook struct {
	Queue func(invocation *BatchQueue, query string, args ...interface{}) error
}

type BatchQueue

type BatchQueue invocation[Batch, BatchHook, func(query string, args ...interface{}) error]

func NewBatchQueue

func NewBatchQueue(recv *Batch, original func(query string, args ...interface{}) error) *BatchQueue

func (*BatchQueue) Proceed

func (invocation *BatchQueue) Proceed(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 BatchResultsClose

type BatchResultsClose invocation[BatchResults, BatchResultsHook, func() error]

func NewBatchResultsClose

func NewBatchResultsClose(recv *BatchResults, original func() error) *BatchResultsClose

func (*BatchResultsClose) Proceed

func (invocation *BatchResultsClose) Proceed() error

type BatchResultsExec

type BatchResultsExec invocation[BatchResults, BatchResultsHook, func() (pgconn.CommandTag, error)]

func NewBatchResultsExec

func NewBatchResultsExec(recv *BatchResults, original func() (pgconn.CommandTag, error)) *BatchResultsExec

func (*BatchResultsExec) Proceed

func (invocation *BatchResultsExec) Proceed() (pgconn.CommandTag, error)

type BatchResultsHook

type BatchResultsHook struct {
	Close func(invocation *BatchResultsClose) error
	Exec  func(invocation *BatchResultsExec) (pgconn.CommandTag, error)
	Query func(invocation *BatchResultsQuery) (*Rows, error)
}

type BatchResultsQuery

type BatchResultsQuery invocation[BatchResults, BatchResultsHook, func() (*Rows, error)]

func NewBatchResultsQuery

func NewBatchResultsQuery(recv *BatchResults, original func() (*Rows, error)) *BatchResultsQuery

func (*BatchResultsQuery) Proceed

func (invocation *BatchResultsQuery) Proceed() (*Rows, error)

type Conn

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

func Connect

func Connect(ctx context.Context, connString string, hooks ...interface{}) (*Conn, error)

func ConnectConfig

func ConnectConfig(ctx context.Context, connConfig *pgx.ConnConfig, hooks ...interface{}) (*Conn, error)

func NewConn

func NewConn(conn *pgx.Conn, core *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, fn 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 ConnBeginTx

type ConnBeginTx invocation[Conn, ConnHook, func(ctx context.Context, txOptions pgx.TxOptions) (*Tx, error)]

func NewConnBeginTx

func NewConnBeginTx(recv *Conn, original func(ctx context.Context, txOptions pgx.TxOptions) (*Tx, error)) *ConnBeginTx

func (*ConnBeginTx) Proceed

func (invocation *ConnBeginTx) Proceed(ctx context.Context, txOptions pgx.TxOptions) (*Tx, error)

type ConnBeginTxFunc

type ConnBeginTxFunc invocation[Conn, ConnHook, func(ctx context.Context, txOptions pgx.TxOptions, fn func(*Tx) error) error]

func NewConnBeginTxFunc

func NewConnBeginTxFunc(recv *Conn, original func(ctx context.Context, txOptions pgx.TxOptions, fn func(*Tx) error) error) *ConnBeginTxFunc

func (*ConnBeginTxFunc) Proceed

func (invocation *ConnBeginTxFunc) Proceed(ctx context.Context, txOptions pgx.TxOptions, fn func(*Tx) error) error

type ConnClose

type ConnClose invocation[Conn, ConnHook, func(ctx context.Context) error]

func NewConnClose

func NewConnClose(recv *Conn, original func(ctx context.Context) error) *ConnClose

func (*ConnClose) Proceed

func (invocation *ConnClose) Proceed(ctx context.Context) error

type ConnCopyFrom

type ConnCopyFrom invocation[Conn, ConnHook, func(ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)]

func NewConnCopyFrom

func NewConnCopyFrom(recv *Conn, original func(ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)) *ConnCopyFrom

func (*ConnCopyFrom) Proceed

func (invocation *ConnCopyFrom) Proceed(ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)

type ConnExec

type ConnExec invocation[Conn, ConnHook, func(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)]

func NewConnExec

func NewConnExec(recv *Conn, original func(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)) *ConnExec

func (*ConnExec) Proceed

func (invocation *ConnExec) Proceed(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)

type ConnFind

type ConnFind invocation[Conn, ConnHook, func(ctx context.Context, dest interface{}, query string, args ...interface{}) error]

func NewConnFind

func NewConnFind(recv *Conn, original func(ctx context.Context, dest interface{}, query string, args ...interface{}) error) *ConnFind

func (*ConnFind) Proceed

func (invocation *ConnFind) Proceed(ctx context.Context, dest interface{}, query string, args ...interface{}) error

type ConnFindAll

type ConnFindAll invocation[Conn, ConnHook, func(ctx context.Context, dest interface{}, query string, args ...interface{}) error]

func NewConnFindAll

func NewConnFindAll(recv *Conn, original func(ctx context.Context, dest interface{}, query string, args ...interface{}) error) *ConnFindAll

func (*ConnFindAll) Proceed

func (invocation *ConnFindAll) Proceed(ctx context.Context, dest interface{}, query string, args ...interface{}) error

type ConnHook

type ConnHook struct {
	BeginTx     func(invocation *ConnBeginTx, ctx context.Context, txOptions pgx.TxOptions) (*Tx, error)
	BeginTxFunc func(invocation *ConnBeginTxFunc, ctx context.Context, txOptions pgx.TxOptions, fn func(*Tx) error) error
	CopyFrom    func(invocation *ConnCopyFrom, ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)
	Exec        func(invocation *ConnExec, ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)
	Ping        func(invocation *ConnPing, ctx context.Context) error
	Prepare     func(invocation *ConnPrepare, ctx context.Context, query string, examples ...interface{}) (*Stmt, error)
	Query       func(invocation *ConnQuery, ctx context.Context, query string, args ...interface{}) (*Rows, error)
	SendBatch   func(invocation *ConnSendBatch, ctx context.Context, batch *Batch) *BatchResults
	Find        func(invocation *ConnFind, ctx context.Context, dest interface{}, query string, args ...interface{}) error
	FindAll     func(invocation *ConnFindAll, ctx context.Context, dest interface{}, query string, args ...interface{}) error
	Close       func(invocation *ConnClose, ctx context.Context) error
}

type ConnPing

type ConnPing invocation[Conn, ConnHook, func(ctx context.Context) error]

func NewConnPing

func NewConnPing(recv *Conn, original func(ctx context.Context) error) *ConnPing

func (*ConnPing) Proceed

func (invocation *ConnPing) Proceed(ctx context.Context) error

type ConnPrepare

type ConnPrepare invocation[Conn, ConnHook, func(ctx context.Context, query string, examples ...interface{}) (*Stmt, error)]

func NewConnPrepare

func NewConnPrepare(recv *Conn, original func(ctx context.Context, query string, examples ...interface{}) (*Stmt, error)) *ConnPrepare

func (*ConnPrepare) Proceed

func (invocation *ConnPrepare) Proceed(ctx context.Context, query string, examples ...interface{}) (*Stmt, error)

type ConnQuery

type ConnQuery invocation[Conn, ConnHook, func(ctx context.Context, query string, args ...interface{}) (*Rows, error)]

func NewConnQuery

func NewConnQuery(recv *Conn, original func(ctx context.Context, query string, args ...interface{}) (*Rows, error)) *ConnQuery

func (*ConnQuery) Proceed

func (invocation *ConnQuery) Proceed(ctx context.Context, query string, args ...interface{}) (*Rows, error)

type ConnSendBatch

type ConnSendBatch invocation[Conn, ConnHook, func(ctx context.Context, batch *Batch) *BatchResults]

func NewConnSendBatch

func NewConnSendBatch(recv *Conn, original func(ctx context.Context, batch *Batch) *BatchResults) *ConnSendBatch

func (*ConnSendBatch) Proceed

func (invocation *ConnSendBatch) Proceed(ctx context.Context, batch *Batch) *BatchResults

type Core

type Core struct {
	*kra.Core
	// contains filtered or unexported fields
}

func NewCore

func NewCore(core *kra.Core, hooks ...interface{}) *Core

type DB

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

func NewDB

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

func Open

func Open(ctx context.Context, connString string, hooks ...interface{}) (*DB, error)

func OpenConfig

func OpenConfig(ctx context.Context, config *pgxpool.Config, hooks ...interface{}) (*DB, error)

func (*DB) Begin

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

func (*DB) BeginFunc

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

func (*DB) BeginTx

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

func (*DB) BeginTxFunc

func (db *DB) BeginTxFunc(ctx context.Context, txOptions pgx.TxOptions, fn func(*Tx) error) 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 DBBeginTx

type DBBeginTx invocation[DB, DBHook, func(ctx context.Context, txOptions pgx.TxOptions) (*Tx, error)]

func NewDBBeginTx

func NewDBBeginTx(recv *DB, original func(ctx context.Context, txOptions pgx.TxOptions) (*Tx, error)) *DBBeginTx

func (*DBBeginTx) Proceed

func (invocation *DBBeginTx) Proceed(ctx context.Context, txOptions pgx.TxOptions) (*Tx, error)

type DBBeginTxFunc

type DBBeginTxFunc invocation[DB, DBHook, func(ctx context.Context, txOptions pgx.TxOptions, fn func(*Tx) error) error]

func NewDBBeginTxFunc

func NewDBBeginTxFunc(recv *DB, original func(ctx context.Context, txOptions pgx.TxOptions, fn func(*Tx) error) error) *DBBeginTxFunc

func (*DBBeginTxFunc) Proceed

func (invocation *DBBeginTxFunc) Proceed(ctx context.Context, txOptions pgx.TxOptions, fn func(*Tx) error) error

type DBClose

type DBClose invocation[DB, DBHook, func() error]

func NewDBClose

func NewDBClose(recv *DB, original func() error) *DBClose

func (*DBClose) Proceed

func (invocation *DBClose) Proceed() error

type DBCopyFrom

type DBCopyFrom invocation[DB, DBHook, func(ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)]

func NewDBCopyFrom

func NewDBCopyFrom(recv *DB, original func(ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)) *DBCopyFrom

func (*DBCopyFrom) Proceed

func (invocation *DBCopyFrom) Proceed(ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)

type DBExec

type DBExec invocation[DB, DBHook, func(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)]

func NewDBExec

func NewDBExec(recv *DB, original func(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)) *DBExec

func (*DBExec) Proceed

func (invocation *DBExec) Proceed(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)

type DBFind

type DBFind invocation[DB, DBHook, func(ctx context.Context, dest interface{}, query string, args ...interface{}) error]

func NewDBFind

func NewDBFind(recv *DB, original func(ctx context.Context, dest interface{}, query string, args ...interface{}) error) *DBFind

func (*DBFind) Proceed

func (invocation *DBFind) Proceed(ctx context.Context, dest interface{}, query string, args ...interface{}) error

type DBFindAll

type DBFindAll invocation[DB, DBHook, func(ctx context.Context, dest interface{}, query string, args ...interface{}) error]

func NewDBFindAll

func NewDBFindAll(recv *DB, original func(ctx context.Context, dest interface{}, query string, args ...interface{}) error) *DBFindAll

func (*DBFindAll) Proceed

func (invocation *DBFindAll) Proceed(ctx context.Context, dest interface{}, query string, args ...interface{}) error

type DBHook

type DBHook struct {
	BeginTx     func(invocation *DBBeginTx, ctx context.Context, txOptions pgx.TxOptions) (*Tx, error)
	BeginTxFunc func(invocation *DBBeginTxFunc, ctx context.Context, txOptions pgx.TxOptions, fn func(*Tx) error) error
	CopyFrom    func(invocation *DBCopyFrom, ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)
	Exec        func(invocation *DBExec, ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)
	Ping        func(invocation *DBPing, ctx context.Context) error
	Prepare     func(invocation *DBPrepare, ctx context.Context, query string, examples ...interface{}) (*PooledStmt, error)
	Query       func(invocation *DBQuery, ctx context.Context, query string, args ...interface{}) (*Rows, error)
	SendBatch   func(invocation *DBSendBatch, ctx context.Context, batch *Batch) *BatchResults
	Find        func(invocation *DBFind, ctx context.Context, dest interface{}, query string, args ...interface{}) error
	FindAll     func(invocation *DBFindAll, ctx context.Context, dest interface{}, query string, args ...interface{}) error
	Close       func(invocation *DBClose) error
}

type DBPing

type DBPing invocation[DB, DBHook, func(ctx context.Context) error]

func NewDBPing

func NewDBPing(recv *DB, original func(ctx context.Context) error) *DBPing

func (*DBPing) Proceed

func (invocation *DBPing) Proceed(ctx context.Context) error

type DBPrepare

type DBPrepare invocation[DB, DBHook, func(ctx context.Context, query string, examples ...interface{}) (*PooledStmt, error)]

func NewDBPrepare

func NewDBPrepare(recv *DB, original func(ctx context.Context, query string, examples ...interface{}) (*PooledStmt, error)) *DBPrepare

func (*DBPrepare) Proceed

func (invocation *DBPrepare) Proceed(ctx context.Context, query string, examples ...interface{}) (*PooledStmt, error)

type DBQuery

type DBQuery invocation[DB, DBHook, func(ctx context.Context, query string, args ...interface{}) (*Rows, error)]

func NewDBQuery

func NewDBQuery(recv *DB, original func(ctx context.Context, query string, args ...interface{}) (*Rows, error)) *DBQuery

func (*DBQuery) Proceed

func (invocation *DBQuery) Proceed(ctx context.Context, query string, args ...interface{}) (*Rows, error)

type DBSendBatch

type DBSendBatch invocation[DB, DBHook, func(ctx context.Context, batch *Batch) *BatchResults]

func NewDBSendBatch

func NewDBSendBatch(recv *DB, original func(ctx context.Context, batch *Batch) *BatchResults) *DBSendBatch

func (*DBSendBatch) Proceed

func (invocation *DBSendBatch) Proceed(ctx context.Context, batch *Batch) *BatchResults

type HookHolster

type HookHolster struct {
	Core         []*kra.CoreHook
	Conn         []*ConnHook
	DB           []*DBHook
	Tx           []*TxHook
	Stmt         []*StmtHook
	Rows         []*RowsHook
	Batch        []*BatchHook
	BatchResults []*BatchResultsHook
}

func NewHookHolster

func NewHookHolster(hooks ...interface{}) *HookHolster

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 Rows

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

func NewRows

func NewRows(core *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 RowsClose

type RowsClose invocation[Rows, RowsHook, func() error]

func NewRowsClose

func NewRowsClose(recv *Rows, original func() error) *RowsClose

func (*RowsClose) Proceed

func (invocation *RowsClose) Proceed() error

type RowsErr

type RowsErr invocation[Rows, RowsHook, func() error]

func NewRowsErr

func NewRowsErr(recv *Rows, original func() error) *RowsErr

func (*RowsErr) Proceed

func (invocation *RowsErr) Proceed() error

type RowsHook

type RowsHook struct {
	Next  func(invocation *RowsNext) bool
	Err   func(invocation *RowsErr) error
	Scan  func(invocation *RowsScan, dest interface{}) error
	Close func(invocation *RowsClose) error
}

type RowsNext

type RowsNext invocation[Rows, RowsHook, func() bool]

func NewRowsNext

func NewRowsNext(recv *Rows, original func() bool) *RowsNext

func (*RowsNext) Proceed

func (invocation *RowsNext) Proceed() bool

type RowsScan

type RowsScan invocation[Rows, RowsHook, func(dest interface{}) error]

func NewRowsScan

func NewRowsScan(recv *Rows, original func(dest interface{}) error) *RowsScan

func (*RowsScan) Proceed

func (invocation *RowsScan) Proceed(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 StmtClose

type StmtClose invocation[Stmt, StmtHook, func(ctx context.Context) error]

func NewStmtClose

func NewStmtClose(recv *Stmt, original func(ctx context.Context) error) *StmtClose

func (*StmtClose) Proceed

func (invocation *StmtClose) Proceed(ctx context.Context) error

type StmtExec

type StmtExec invocation[Stmt, StmtHook, func(ctx context.Context, args ...interface{}) (pgconn.CommandTag, error)]

func NewStmtExec

func NewStmtExec(recv *Stmt, original func(ctx context.Context, args ...interface{}) (pgconn.CommandTag, error)) *StmtExec

func (*StmtExec) Proceed

func (invocation *StmtExec) Proceed(ctx context.Context, args ...interface{}) (pgconn.CommandTag, error)

type StmtHook

type StmtHook struct {
	Exec  func(invocation *StmtExec, ctx context.Context, args ...interface{}) (pgconn.CommandTag, error)
	Query func(invocation *StmtQuery, ctx context.Context, args ...interface{}) (*Rows, error)
	Close func(invocation *StmtClose, ctx context.Context) error
}

type StmtQuery

type StmtQuery invocation[Stmt, StmtHook, func(ctx context.Context, args ...interface{}) (*Rows, error)]

func NewStmtQuery

func NewStmtQuery(recv *Stmt, original func(ctx context.Context, args ...interface{}) (*Rows, error)) *StmtQuery

func (*StmtQuery) Proceed

func (invocation *StmtQuery) Proceed(ctx context.Context, args ...interface{}) (*Rows, error)

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, fn 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

type TxBegin

type TxBegin invocation[Tx, TxHook, func(ctx context.Context) (*Tx, error)]

func NewTxBegin

func NewTxBegin(recv *Tx, original func(ctx context.Context) (*Tx, error)) *TxBegin

func (*TxBegin) Proceed

func (invocation *TxBegin) Proceed(ctx context.Context) (*Tx, error)

type TxBeginFunc

type TxBeginFunc invocation[Tx, TxHook, func(ctx context.Context, fn func(*Tx) error) error]

func NewTxBeginFunc

func NewTxBeginFunc(recv *Tx, original func(ctx context.Context, fn func(*Tx) error) error) *TxBeginFunc

func (*TxBeginFunc) Proceed

func (invocation *TxBeginFunc) Proceed(ctx context.Context, fn func(*Tx) error) error

type TxClose

type TxClose invocation[Tx, TxHook, func(ctx context.Context) error]

func NewTxClose

func NewTxClose(recv *Tx, original func(ctx context.Context) error) *TxClose

func (*TxClose) Proceed

func (invocation *TxClose) Proceed(ctx context.Context) error

type TxCommit

type TxCommit invocation[Tx, TxHook, func(ctx context.Context) error]

func NewTxCommit

func NewTxCommit(recv *Tx, original func(ctx context.Context) error) *TxCommit

func (*TxCommit) Proceed

func (invocation *TxCommit) Proceed(ctx context.Context) error

type TxCopyFrom

type TxCopyFrom invocation[Tx, TxHook, func(ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)]

func NewTxCopyFrom

func NewTxCopyFrom(recv *Tx, original func(ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)) *TxCopyFrom

func (*TxCopyFrom) Proceed

func (invocation *TxCopyFrom) Proceed(ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)

type TxExec

type TxExec invocation[Tx, TxHook, func(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)]

func NewTxExec

func NewTxExec(recv *Tx, original func(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)) *TxExec

func (*TxExec) Proceed

func (invocation *TxExec) Proceed(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)

type TxFind

type TxFind invocation[Tx, TxHook, func(ctx context.Context, dest interface{}, query string, args ...interface{}) error]

func NewTxFind

func NewTxFind(recv *Tx, original func(ctx context.Context, dest interface{}, query string, args ...interface{}) error) *TxFind

func (*TxFind) Proceed

func (invocation *TxFind) Proceed(ctx context.Context, dest interface{}, query string, args ...interface{}) error

type TxFindAll

type TxFindAll invocation[Tx, TxHook, func(ctx context.Context, dest interface{}, query string, args ...interface{}) error]

func NewTxFindAll

func NewTxFindAll(recv *Tx, original func(ctx context.Context, dest interface{}, query string, args ...interface{}) error) *TxFindAll

func (*TxFindAll) Proceed

func (invocation *TxFindAll) Proceed(ctx context.Context, dest interface{}, query string, args ...interface{}) error

type TxHook

type TxHook struct {
	Begin     func(invocation *TxBegin, ctx context.Context) (*Tx, error)
	BeginFunc func(invocation *TxBeginFunc, ctx context.Context, f func(*Tx) error) error
	Commit    func(invocation *TxCommit, ctx context.Context) error
	Rollback  func(invocation *TxRollback, ctx context.Context) error
	CopyFrom  func(invocation *TxCopyFrom, ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)
	Exec      func(invocation *TxExec, ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)
	Ping      func(invocation *TxPing, ctx context.Context) error
	Prepare   func(invocation *TxPrepare, ctx context.Context, query string, examples ...interface{}) (*Stmt, error)
	Query     func(invocation *TxQuery, ctx context.Context, query string, args ...interface{}) (*Rows, error)
	SendBatch func(invocation *TxSendBatch, ctx context.Context, batch *Batch) *BatchResults
	Find      func(invocation *TxFind, ctx context.Context, dest interface{}, query string, args ...interface{}) error
	FindAll   func(invocation *TxFindAll, ctx context.Context, dest interface{}, query string, args ...interface{}) error
	Close     func(invocation *TxClose, ctx context.Context) error
}

type TxPing

type TxPing invocation[Tx, TxHook, func(ctx context.Context) error]

func NewTxPing

func NewTxPing(recv *Tx, original func(ctx context.Context) error) *TxPing

func (*TxPing) Proceed

func (invocation *TxPing) Proceed(ctx context.Context) error

type TxPrepare

type TxPrepare invocation[Tx, TxHook, func(ctx context.Context, query string, examples ...interface{}) (*Stmt, error)]

func NewTxPrepare

func NewTxPrepare(recv *Tx, original func(ctx context.Context, query string, examples ...interface{}) (*Stmt, error)) *TxPrepare

func (*TxPrepare) Proceed

func (invocation *TxPrepare) Proceed(ctx context.Context, query string, examples ...interface{}) (*Stmt, error)

type TxQuery

type TxQuery invocation[Tx, TxHook, func(ctx context.Context, query string, args ...interface{}) (*Rows, error)]

func NewTxQuery

func NewTxQuery(recv *Tx, original func(ctx context.Context, query string, args ...interface{}) (*Rows, error)) *TxQuery

func (*TxQuery) Proceed

func (invocation *TxQuery) Proceed(ctx context.Context, query string, args ...interface{}) (*Rows, error)

type TxRollback

type TxRollback invocation[Tx, TxHook, func(ctx context.Context) error]

func NewTxRollback

func NewTxRollback(recv *Tx, original func(ctx context.Context) error) *TxRollback

func (*TxRollback) Proceed

func (invocation *TxRollback) Proceed(ctx context.Context) error

type TxSendBatch

type TxSendBatch invocation[Tx, TxHook, func(ctx context.Context, batch *Batch) *BatchResults]

func NewTxSendBatch

func NewTxSendBatch(recv *Tx, original func(ctx context.Context, batch *Batch) *BatchResults) *TxSendBatch

func (*TxSendBatch) Proceed

func (invocation *TxSendBatch) Proceed(ctx context.Context, batch *Batch) *BatchResults

Jump to

Keyboard shortcuts

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