Documentation
¶
Index ¶
- type ConnAdapter
- func (c *ConnAdapter) Cli() (*pgxpool.Pool, error)
- 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) HijackConn(ctx context.Context) (*pgx.Conn, 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 ProcessWaitForNotification
- type ReceiverChannel
- type ReceiverChannels
- 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, error)
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) HijackConn ¶ added in v0.17.0
func (c *ConnAdapter) HijackConn(ctx context.Context) (*pgx.Conn, error)
HijackConn - извлекает соединение из пула, которое будет использоваться независимо от него и должно быть закрыто тем, кто вызвал данный метод.
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 - отправляет SQL запрос к БД и возвращает результат в виде списка записей.
func (*ConnAdapter) QueryRow ¶ added in v0.3.1
func (c *ConnAdapter) QueryRow(ctx context.Context, sql string, args ...any) mrstorage.DBQueryRow
QueryRow - отправляет SQL запрос к БД и возвращает результат в виде одной записи.
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, logger mrlog.Logger) *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
ConnTimeout time.Duration
QueryTracer pgx.QueryTracer
AfterConnect func(ctx context.Context, conn *pgx.Conn) error
}
Options - опции для создания соединения для ConnAdapter.
type ProcessWaitForNotification ¶ added in v0.17.0
type ProcessWaitForNotification struct {
ReceiverChannels ReceiverChannels
// contains filtered or unexported fields
}
ProcessWaitForNotification - объект для прослушивания и обработки событий присылаемых БД.
func NewProcessWaitForNotification ¶ added in v0.17.0
func NewProcessWaitForNotification( conn *ConnAdapter, logger mrlog.Logger, channels []string, ) *ProcessWaitForNotification
NewProcessWaitForNotification - создаёт объект ProcessWaitForNotification.
func (*ProcessWaitForNotification) Caption ¶ added in v0.17.0
func (p *ProcessWaitForNotification) Caption() string
Caption - comment struct.
func (*ProcessWaitForNotification) ReadyTimeout ¶ added in v0.17.0
func (p *ProcessWaitForNotification) ReadyTimeout() time.Duration
ReadyTimeout - comment struct.
type ReceiverChannel ¶ added in v0.17.0
type ReceiverChannel struct {
Name string
Channel <-chan struct{}
}
ReceiverChannel - comment struct.
type ReceiverChannels ¶ added in v0.17.0
type ReceiverChannels []ReceiverChannel
ReceiverChannels - comment array.
func (*ReceiverChannels) Find ¶ added in v0.17.0
func (rc *ReceiverChannels) Find(name string) (<-chan struct{}, error)
Find - comment method.
func (*ReceiverChannels) MustFind ¶ added in v0.17.0
func (rc *ReceiverChannels) MustFind(name string) <-chan struct{}
MustFind - comment method.
type TxManagerStub ¶ added in v0.11.0
type TxManagerStub struct{}
TxManagerStub - фиктивный менеджер транзакций, который запускает только переданную работу без открытия транзакции.
func NewTxManagerStub ¶ added in v0.11.0
func NewTxManagerStub() *TxManagerStub
NewTxManagerStub - создаёт объект TxManagerStub.