pgx

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 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 added in v0.2.0

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

type BatchQueue added in v0.2.0

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

func NewBatchQueue added in v0.2.0

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

func (*BatchQueue) Proceed added in v0.2.0

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 added in v0.2.0

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

func NewBatchResultsClose added in v0.2.0

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

func (*BatchResultsClose) Proceed added in v0.2.0

func (invocation *BatchResultsClose) Proceed() error

type BatchResultsExec added in v0.2.0

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

func NewBatchResultsExec added in v0.2.0

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

func (*BatchResultsExec) Proceed added in v0.2.0

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

type BatchResultsHook added in v0.2.0

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

type BatchResultsQuery added in v0.2.0

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

func NewBatchResultsQuery added in v0.2.0

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

func (*BatchResultsQuery) Proceed added in v0.2.0

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 added in v0.2.0

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 added in v0.2.0

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

func NewConnBeginTx added in v0.2.0

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

func (*ConnBeginTx) Proceed added in v0.2.0

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

type ConnBeginTxFunc added in v0.2.0

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

func NewConnBeginTxFunc added in v0.2.0

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

func (*ConnBeginTxFunc) Proceed added in v0.2.0

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

type ConnClose added in v0.2.0

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

func NewConnClose added in v0.2.0

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

func (*ConnClose) Proceed added in v0.2.0

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

type ConnCopyFrom added in v0.2.0

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

func NewConnCopyFrom added in v0.2.0

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

func (*ConnCopyFrom) Proceed added in v0.2.0

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

type ConnExec added in v0.2.0

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

func NewConnExec added in v0.2.0

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

func (*ConnExec) Proceed added in v0.2.0

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

type ConnFind added in v0.2.0

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

func NewConnFind added in v0.2.0

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

func (*ConnFind) Proceed added in v0.2.0

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

type ConnFindAll added in v0.2.0

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

func NewConnFindAll added in v0.2.0

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

func (*ConnFindAll) Proceed added in v0.2.0

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

type ConnHook added in v0.2.0

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 added in v0.2.0

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

func NewConnPing added in v0.2.0

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

func (*ConnPing) Proceed added in v0.2.0

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

type ConnPrepare added in v0.2.0

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

func NewConnPrepare added in v0.2.0

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

func (*ConnPrepare) Proceed added in v0.2.0

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

type ConnQuery added in v0.2.0

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

func NewConnQuery added in v0.2.0

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

func (*ConnQuery) Proceed added in v0.2.0

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

type ConnSendBatch added in v0.2.0

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

func NewConnSendBatch added in v0.2.0

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

func (*ConnSendBatch) Proceed added in v0.2.0

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

type Core added in v0.2.0

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

func NewCore added in v0.2.0

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 added in v0.2.0

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 added in v0.2.0

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 added in v0.2.0

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

func NewDBBeginTx added in v0.2.0

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

func (*DBBeginTx) Proceed added in v0.2.0

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

type DBBeginTxFunc added in v0.2.0

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

func NewDBBeginTxFunc added in v0.2.0

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

func (*DBBeginTxFunc) Proceed added in v0.2.0

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

type DBClose added in v0.2.0

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

func NewDBClose added in v0.2.0

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

func (*DBClose) Proceed added in v0.2.0

func (invocation *DBClose) Proceed() error

type DBCopyFrom added in v0.2.0

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

func NewDBCopyFrom added in v0.2.0

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

func (*DBCopyFrom) Proceed added in v0.2.0

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

type DBExec added in v0.2.0

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

func NewDBExec added in v0.2.0

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

func (*DBExec) Proceed added in v0.2.0

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

type DBFind added in v0.2.0

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

func NewDBFind added in v0.2.0

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

func (*DBFind) Proceed added in v0.2.0

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

type DBFindAll added in v0.2.0

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

func NewDBFindAll added in v0.2.0

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

func (*DBFindAll) Proceed added in v0.2.0

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

type DBHook added in v0.2.0

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 added in v0.2.0

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

func NewDBPing added in v0.2.0

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

func (*DBPing) Proceed added in v0.2.0

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

type DBPrepare added in v0.2.0

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

func NewDBPrepare added in v0.2.0

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

func (*DBPrepare) Proceed added in v0.2.0

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

type DBQuery added in v0.2.0

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

func NewDBQuery added in v0.2.0

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

func (*DBQuery) Proceed added in v0.2.0

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

type DBSendBatch added in v0.2.0

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

func NewDBSendBatch added in v0.2.0

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

func (*DBSendBatch) Proceed added in v0.2.0

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

type HookHolster added in v0.2.0

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

func NewHookHolster added in v0.2.0

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 added in v0.2.0

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

func NewRowsClose added in v0.2.0

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

func (*RowsClose) Proceed added in v0.2.0

func (invocation *RowsClose) Proceed() error

type RowsErr added in v0.2.0

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

func NewRowsErr added in v0.2.0

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

func (*RowsErr) Proceed added in v0.2.0

func (invocation *RowsErr) Proceed() error

type RowsHook added in v0.2.0

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 added in v0.2.0

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

func NewRowsNext added in v0.2.0

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

func (*RowsNext) Proceed added in v0.2.0

func (invocation *RowsNext) Proceed() bool

type RowsScan added in v0.2.0

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

func NewRowsScan added in v0.2.0

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

func (*RowsScan) Proceed added in v0.2.0

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 added in v0.2.0

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

func NewStmtClose added in v0.2.0

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

func (*StmtClose) Proceed added in v0.2.0

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

type StmtExec added in v0.2.0

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

func NewStmtExec added in v0.2.0

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

func (*StmtExec) Proceed added in v0.2.0

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

type StmtHook added in v0.2.0

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 added in v0.2.0

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

func NewStmtQuery added in v0.2.0

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

func (*StmtQuery) Proceed added in v0.2.0

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 added in v0.2.0

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

func NewTxBegin added in v0.2.0

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

func (*TxBegin) Proceed added in v0.2.0

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

type TxBeginFunc added in v0.2.0

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

func NewTxBeginFunc added in v0.2.0

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

func (*TxBeginFunc) Proceed added in v0.2.0

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

type TxClose added in v0.2.0

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

func NewTxClose added in v0.2.0

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

func (*TxClose) Proceed added in v0.2.0

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

type TxCommit added in v0.2.0

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

func NewTxCommit added in v0.2.0

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

func (*TxCommit) Proceed added in v0.2.0

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

type TxCopyFrom added in v0.2.0

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

func NewTxCopyFrom added in v0.2.0

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

func (*TxCopyFrom) Proceed added in v0.2.0

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

type TxExec added in v0.2.0

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

func NewTxExec added in v0.2.0

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

func (*TxExec) Proceed added in v0.2.0

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

type TxFind added in v0.2.0

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

func NewTxFind added in v0.2.0

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

func (*TxFind) Proceed added in v0.2.0

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

type TxFindAll added in v0.2.0

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

func NewTxFindAll added in v0.2.0

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

func (*TxFindAll) Proceed added in v0.2.0

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

type TxHook added in v0.2.0

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 added in v0.2.0

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

func NewTxPing added in v0.2.0

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

func (*TxPing) Proceed added in v0.2.0

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

type TxPrepare added in v0.2.0

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

func NewTxPrepare added in v0.2.0

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

func (*TxPrepare) Proceed added in v0.2.0

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

type TxQuery added in v0.2.0

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

func NewTxQuery added in v0.2.0

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

func (*TxQuery) Proceed added in v0.2.0

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

type TxRollback added in v0.2.0

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

func NewTxRollback added in v0.2.0

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

func (*TxRollback) Proceed added in v0.2.0

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

type TxSendBatch added in v0.2.0

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

func NewTxSendBatch added in v0.2.0

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

func (*TxSendBatch) Proceed added in v0.2.0

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