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 ¶ added in v0.2.0
type BatchHook struct {
Queue func(invocation *BatchQueue, query string, args ...interface{}) error
}
type BatchQueue ¶ added in v0.2.0
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 ConnectConfig ¶ added in v0.2.0
func (*Conn) BeginTxFunc ¶
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
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
type ConnClose ¶ added in v0.2.0
func NewConnClose ¶ added in v0.2.0
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
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
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
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
func NewConnPing ¶ added in v0.2.0
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
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
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 DB ¶
type DB struct {
// contains filtered or unexported fields
}
func OpenConfig ¶
func (*DB) BeginTxFunc ¶ added in v0.2.0
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
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
type DBClose ¶ added in v0.2.0
func NewDBClose ¶ added in v0.2.0
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)]
type DBFind ¶ added in v0.2.0
type DBFind invocation[DB, DBHook, func(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
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 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
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
type DBSendBatch ¶ added in v0.2.0
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) 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 ¶ added in v0.2.0
func NewRowsClose ¶ added in v0.2.0
type RowsErr ¶ added in v0.2.0
func NewRowsErr ¶ added in v0.2.0
type RowsNext ¶ added in v0.2.0
func NewRowsNext ¶ added in v0.2.0
type RowsScan ¶ added in v0.2.0
func NewRowsScan ¶ added in v0.2.0
type Stmt ¶
type Stmt struct {
// contains filtered or unexported fields
}
func (*Stmt) Stmt ¶
func (stmt *Stmt) Stmt() *pgconn.StatementDescription
type StmtClose ¶ added in v0.2.0
func NewStmtClose ¶ added in v0.2.0
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
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
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
type TxBegin ¶ added in v0.2.0
func NewTxBegin ¶ added in v0.2.0
type TxBeginFunc ¶ added in v0.2.0
func NewTxBeginFunc ¶ added in v0.2.0
type TxClose ¶ added in v0.2.0
func NewTxClose ¶ added in v0.2.0
type TxCommit ¶ added in v0.2.0
func NewTxCommit ¶ added in v0.2.0
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)]
type TxFind ¶ added in v0.2.0
type TxFind invocation[Tx, TxHook, func(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
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 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
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
type TxRollback ¶ added in v0.2.0
func NewTxRollback ¶ added in v0.2.0
func NewTxRollback(recv *Tx, original func(ctx context.Context) error) *TxRollback
type TxSendBatch ¶ added in v0.2.0
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
Click to show internal directories.
Click to hide internal directories.