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 ¶
- Variables
- type Batch
- type BatchHook
- type BatchQueue
- type BatchResults
- type BatchResultsClose
- type BatchResultsExec
- type BatchResultsHook
- type BatchResultsQuery
- type Conn
- func (conn *Conn) Begin(ctx context.Context) (*Tx, error)
- func (conn *Conn) BeginFunc(ctx context.Context, f func(*Tx) error) error
- func (conn *Conn) BeginTx(ctx context.Context, txOptions pgx.TxOptions) (*Tx, error)
- func (conn *Conn) BeginTxFunc(ctx context.Context, txOptions pgx.TxOptions, fn func(*Tx) error) error
- func (conn *Conn) Close(ctx context.Context) error
- func (conn *Conn) Conn() *pgx.Conn
- func (conn *Conn) CopyFrom(ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)
- func (conn *Conn) Exec(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)
- func (conn *Conn) Find(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (conn *Conn) FindAll(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (conn *Conn) Ping(ctx context.Context) error
- func (conn *Conn) Prepare(ctx context.Context, query string, examples ...interface{}) (*Stmt, error)
- func (conn *Conn) Query(ctx context.Context, query string, args ...interface{}) (*Rows, error)
- func (conn *Conn) SendBatch(ctx context.Context, batch *Batch) *BatchResults
- type ConnBeginTx
- type ConnBeginTxFunc
- type ConnClose
- type ConnCopyFrom
- type ConnExec
- type ConnFind
- type ConnFindAll
- type ConnHook
- type ConnPing
- type ConnPrepare
- type ConnQuery
- type ConnSendBatch
- type Core
- type DB
- func (db *DB) Begin(ctx context.Context) (*Tx, error)
- func (db *DB) BeginFunc(ctx context.Context, f func(*Tx) error) error
- func (db *DB) BeginTx(ctx context.Context, opts pgx.TxOptions) (*Tx, error)
- func (db *DB) BeginTxFunc(ctx context.Context, txOptions pgx.TxOptions, fn func(*Tx) error) error
- func (db *DB) Close() error
- func (db *DB) CopyFrom(ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)
- func (db *DB) Exec(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)
- func (db *DB) Find(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (db *DB) FindAll(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (db *DB) Ping(ctx context.Context) error
- func (db *DB) Pool() *pgxpool.Pool
- func (db *DB) Prepare(ctx context.Context, query string, examples ...interface{}) (*PooledStmt, error)
- func (db *DB) Query(ctx context.Context, query string, args ...interface{}) (*Rows, error)
- func (db *DB) SendBatch(ctx context.Context, batch *Batch) *BatchResults
- type DBBeginTx
- type DBBeginTxFunc
- type DBClose
- type DBCopyFrom
- type DBExec
- type DBFind
- type DBFindAll
- type DBHook
- type DBPing
- type DBPrepare
- type DBQuery
- type DBSendBatch
- type HookHolster
- type Identifier
- type PooledStmt
- func (stmt *PooledStmt) Close(ctx context.Context) error
- func (stmt *PooledStmt) Exec(ctx context.Context, args ...interface{}) (pgconn.CommandTag, error)
- func (stmt *PooledStmt) Query(ctx context.Context, args ...interface{}) (*Rows, error)
- func (stmt *PooledStmt) Stmt() *pgconn.StatementDescription
- type Rows
- type RowsClose
- type RowsErr
- type RowsHook
- type RowsNext
- type RowsScan
- type Stmt
- type StmtClose
- type StmtExec
- type StmtHook
- type StmtQuery
- type Tx
- func (tx *Tx) Begin(ctx context.Context) (*Tx, error)
- func (tx *Tx) BeginFunc(ctx context.Context, fn func(*Tx) error) error
- func (tx *Tx) Commit(ctx context.Context) error
- func (tx *Tx) CopyFrom(ctx context.Context, tableName Identifier, rowSrc interface{}) (int64, error)
- func (tx *Tx) Exec(ctx context.Context, query string, args ...interface{}) (pgconn.CommandTag, error)
- func (tx *Tx) Find(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (tx *Tx) FindAll(ctx context.Context, dest interface{}, query string, args ...interface{}) error
- func (tx *Tx) Prepare(ctx context.Context, query string, examples ...interface{}) (*Stmt, error)
- func (tx *Tx) Query(ctx context.Context, query string, args ...interface{}) (*Rows, error)
- func (tx *Tx) Rollback(ctx context.Context) error
- func (tx *Tx) SendBatch(ctx context.Context, batch *Batch) *BatchResults
- func (tx *Tx) Tx() pgx.Tx
- type TxBegin
- type TxBeginFunc
- type TxClose
- type TxCommit
- type TxCopyFrom
- type TxExec
- type TxFind
- type TxFindAll
- type TxHook
- type TxPing
- type TxPrepare
- type TxQuery
- type TxRollback
- type TxSendBatch
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 BatchHook ¶
type BatchHook struct {
Queue func(invocation *BatchQueue, query string, args ...interface{}) error
}
type BatchQueue ¶
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 ConnectConfig ¶
func (*Conn) BeginTxFunc ¶
type ConnBeginTx ¶
type ConnBeginTx invocation[Conn, ConnHook, func(ctx context.Context, txOptions pgx.TxOptions) (*Tx, error)]
func NewConnBeginTx ¶
type ConnBeginTxFunc ¶
type ConnBeginTxFunc invocation[Conn, ConnHook, func(ctx context.Context, txOptions pgx.TxOptions, fn func(*Tx) error) error]
func NewConnBeginTxFunc ¶
type ConnClose ¶
func NewConnClose ¶
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 ¶
type ConnFind ¶
type ConnFind invocation[Conn, ConnHook, func(ctx context.Context, dest interface{}, query string, args ...interface{}) error]
func NewConnFind ¶
type ConnFindAll ¶
type ConnFindAll invocation[Conn, ConnHook, func(ctx context.Context, dest interface{}, query string, args ...interface{}) error]
func NewConnFindAll ¶
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 ConnPrepare ¶
type ConnPrepare invocation[Conn, ConnHook, func(ctx context.Context, query string, examples ...interface{}) (*Stmt, error)]
func NewConnPrepare ¶
type ConnQuery ¶
type ConnQuery invocation[Conn, ConnHook, func(ctx context.Context, query string, args ...interface{}) (*Rows, error)]
func NewConnQuery ¶
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 DB ¶
type DB struct {
// contains filtered or unexported fields
}
func OpenConfig ¶
func (*DB) BeginTxFunc ¶
type DBBeginTx ¶
type DBBeginTx invocation[DB, DBHook, func(ctx context.Context, txOptions pgx.TxOptions) (*Tx, error)]
func NewDBBeginTx ¶
type DBBeginTxFunc ¶
type DBBeginTxFunc invocation[DB, DBHook, func(ctx context.Context, txOptions pgx.TxOptions, fn func(*Tx) error) error]
func NewDBBeginTxFunc ¶
type DBClose ¶
func NewDBClose ¶
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)]
type DBFind ¶
type DBFind invocation[DB, DBHook, func(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 ¶
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 DBPrepare ¶
type DBPrepare invocation[DB, DBHook, func(ctx context.Context, query string, examples ...interface{}) (*PooledStmt, error)]
func NewDBPrepare ¶
type DBQuery ¶
type DBQuery invocation[DB, DBHook, func(ctx context.Context, query string, args ...interface{}) (*Rows, error)]
func NewDBQuery ¶
type DBSendBatch ¶
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) 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 RowsClose ¶
func NewRowsClose ¶
type RowsErr ¶
func NewRowsErr ¶
type RowsNext ¶
func NewRowsNext ¶
type RowsScan ¶
func NewRowsScan ¶
type Stmt ¶
type Stmt struct {
// contains filtered or unexported fields
}
func (*Stmt) Stmt ¶
func (stmt *Stmt) Stmt() *pgconn.StatementDescription
type StmtClose ¶
func NewStmtClose ¶
type StmtExec ¶
type StmtExec invocation[Stmt, StmtHook, func(ctx context.Context, args ...interface{}) (pgconn.CommandTag, error)]
func NewStmtExec ¶
type StmtQuery ¶
type StmtQuery invocation[Stmt, StmtHook, func(ctx context.Context, args ...interface{}) (*Rows, error)]
func NewStmtQuery ¶
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
type TxBegin ¶
func NewTxBegin ¶
type TxBeginFunc ¶
func NewTxBeginFunc ¶
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)]
type TxFind ¶
type TxFind invocation[Tx, TxHook, func(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 ¶
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 TxPrepare ¶
type TxPrepare invocation[Tx, TxHook, func(ctx context.Context, query string, examples ...interface{}) (*Stmt, error)]
func NewTxPrepare ¶
type TxQuery ¶
type TxQuery invocation[Tx, TxHook, func(ctx context.Context, query string, args ...interface{}) (*Rows, error)]
func NewTxQuery ¶
type TxRollback ¶
func NewTxRollback ¶
func NewTxRollback(recv *Tx, original func(ctx context.Context) error) *TxRollback
type TxSendBatch ¶
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
Click to show internal directories.
Click to hide internal directories.