conns

package
v1.0.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = types.Module{
	{CreateFunc: NewConns},
}.
	Append(postrgres.Module).
	Append(elastic.Module).
	Append(kafka.Module)

Functions

This section is empty.

Types

type Conns

type Conns struct {
	// contains filtered or unexported fields
}

func NewConns

func NewConns(
	logger *zap.Logger,
	elastic *elasticsearch.Client,
	sqlxPoolDB map[string]*sqlx.DB,
	pgxPoolDB map[string]*pgxpool.Pool,
	sqlConns map[string]connectors.DBConnector[*sqlx.DB, *sqlx.Tx],
	goquConns map[string]connectors.DBConnector[*goqu.Database, *goqu.TxDatabase],
	pgxConns map[string]connectors.DBConnector[dbtypes.PgxConn, dbtypes.PgxTx],
	kafka *kafka.Kafka,
) *Conns

func (*Conns) Close

func (c *Conns) Close()

func (*Conns) GetDB deprecated

func (c *Conns) GetDB() (*sqlx.DB, error)

Deprecated: Use GetSQLConnByName instead

func (*Conns) GetElastic

func (c *Conns) GetElastic() (*elasticsearch.Client, error)

GetElastic возвращает клиент для работы с эластиком

func (*Conns) GetGoQuConn

func (c *Conns) GetGoQuConn(nameConn string) (connectors.DBConnector[*goqu.Database, *goqu.TxDatabase], error)

GetGoQuConn создает слой sql-builder'а для конструирования запросов в БД. Также он умеет делать scan в структуры

func (*Conns) GetKafka added in v1.0.9

func (c *Conns) GetKafka() (*kafka.Kafka, error)

GetKafka возвращает абстракцию над кафкой

func (*Conns) GetPGXConnByName added in v1.0.7

func (c *Conns) GetPGXConnByName(nameConn string) (connectors.DBConnector[dbtypes.PgxConn, dbtypes.PgxTx], error)

GetPGXConnByName возвращает коннект к бд, если он есть

func (*Conns) GetSQLConn deprecated

func (c *Conns) GetSQLConn() (connectors.DBConnector[*sqlx.DB, *sqlx.Tx], error)

Deprecated: Use GetSQLConnByName instead

func (*Conns) GetSQLConnByName added in v1.0.1

func (c *Conns) GetSQLConnByName(nameConn string) (connectors.DBConnector[*sqlx.DB, *sqlx.Tx], error)

GetSQLConnByName возвращает коннект к бд, если он есть

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL