go-transaction-manager

Форк
0
29 строк · 1.2 Кб
1
// Package pgxv4 is an implementation of trm.Transaction interface by Transaction for pgx.Tx.
2
package pgxv4
3

4
import (
5
	"context"
6

7
	"github.com/jackc/pgconn"
8
	"github.com/jackc/pgx/v4"
9
)
10

11
// Tr is an interface to work with pgx.Conn, pgxpool.Conn or pgxpool.Pool
12
// StmtContext and Stmt are not implemented!
13
type Tr interface {
14
	Begin(ctx context.Context) (pgx.Tx, error)
15
	BeginFunc(ctx context.Context, f func(pgx.Tx) error) (err error)
16

17
	CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
18
	SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
19

20
	Exec(ctx context.Context, sql string, arguments ...interface{}) (commandTag pgconn.CommandTag, err error)
21
	Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
22
	QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
23
	QueryFunc(ctx context.Context, sql string, args []interface{}, scans []interface{}, f func(pgx.QueryFuncRow) error) (pgconn.CommandTag, error)
24
}
25

26
// Transactional is an interface to work with pgx.Conn, pgxpool.Conn or pgxpool.Pool.
27
type Transactional interface {
28
	BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error)
29
}
30

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.