Documentation
¶
Index ¶
- type ConnAdapter
- func (c *ConnAdapter) Cli() *pgxpool.Pool
- func (c *ConnAdapter) Close() error
- func (c *ConnAdapter) Connect(ctx context.Context, opts Options) error
- func (c *ConnAdapter) Exec(ctx context.Context, sql string, args ...any) error
- func (c *ConnAdapter) Ping(ctx context.Context) error
- func (c *ConnAdapter) Query(ctx context.Context, sql string, args ...any) (mrstorage.DBQueryRows, error)
- func (c *ConnAdapter) QueryRow(ctx context.Context, sql string, args ...any) mrstorage.DBQueryRow
- type ConnManager
- type Options
- type TxManagerStub
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnAdapter ¶ added in v0.3.1
type ConnAdapter struct {
// contains filtered or unexported fields
}
ConnAdapter - адаптер для работы с Postgres клиентом.
func (*ConnAdapter) Cli ¶ added in v0.3.1
func (c *ConnAdapter) Cli() *pgxpool.Pool
Cli - возвращается нативный объект, с которым работает данный адаптер.
func (*ConnAdapter) Close ¶ added in v0.3.1
func (c *ConnAdapter) Close() error
Close - закрывает текущее соединение.
func (*ConnAdapter) Connect ¶ added in v0.3.1
func (c *ConnAdapter) Connect(ctx context.Context, opts Options) error
Connect - создаёт соединение с указанными опциями.
func (*ConnAdapter) Ping ¶ added in v0.3.1
func (c *ConnAdapter) Ping(ctx context.Context) error
Ping - проверяет работоспособность соединения.
func (*ConnAdapter) Query ¶ added in v0.3.1
func (c *ConnAdapter) Query(ctx context.Context, sql string, args ...any) (mrstorage.DBQueryRows, error)
Query - comment method.
func (*ConnAdapter) QueryRow ¶ added in v0.3.1
func (c *ConnAdapter) QueryRow(ctx context.Context, sql string, args ...any) mrstorage.DBQueryRow
QueryRow - comment method.
type ConnManager ¶ added in v0.11.0
type ConnManager struct {
// contains filtered or unexported fields
}
ConnManager - менеджер транзакций.
func NewConnManager ¶ added in v0.11.0
func NewConnManager(conn *ConnAdapter) *ConnManager
NewConnManager - создаёт объект ConnManager.
func (*ConnManager) Conn ¶ added in v0.11.0
func (m *ConnManager) Conn(ctx context.Context) mrstorage.DBConn
Conn - возвращает соединение с PostgreSQL или транзакцию, если она была открыта.
func (*ConnManager) ConnAdapter ¶ added in v0.13.0
func (m *ConnManager) ConnAdapter() *ConnAdapter
ConnAdapter - возвращает соединение с PostgreSQL.
type Options ¶
type Options struct {
DSN string // если указано, то Host, Port, Database, Username не используются, но Password более приоритетен если явно указан
Host string
Port string
Database string
Username string
Password string
MaxPoolSize int
MaxConnLifetime time.Duration
MaxConnIdleTime time.Duration
ConnAttempts int
ConnTimeout time.Duration
QueryTracer pgx.QueryTracer
AfterConnect func(ctx context.Context, conn *pgx.Conn) error
}
Options - опции для создания соединения для ConnAdapter.
type TxManagerStub ¶ added in v0.11.0
type TxManagerStub struct{}
TxManagerStub - фиктивный менеджер транзакций, который запускает только переданную работу без открытия транзакции.
func NewTxManagerStub ¶ added in v0.11.0
func NewTxManagerStub() *TxManagerStub
NewTxManagerStub - создаёт объект TxManagerStub.