database

package
v0.0.0-...-93f7656 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClickhouseConfig

type ClickhouseConfig struct {
	Host        string `cfg:"CH_HOST" default:"localhost"`
	Port        uint16 `cfg:"CH_PORT" default:"9000"`
	User        string `cfg:"CH_USER" default:"default"`
	Pass        string `cfg:"CH_PASS" default:"default"`
	Name        string `cfg:"CH_NAME" default:"default"`
	MustConnect bool   `cfg:"CH_MUST_CONNECT" default:"false"`
}

type ClickhouseDB

type ClickhouseDB struct {
	driver.Conn

	Addr string
	User string
	Pass string
	Name string
	Must bool

	Logger *zap.Logger
}

func NewClickhouse

func NewClickhouse(cfg *ClickhouseConfig) *ClickhouseDB

func (*ClickhouseDB) Close

func (db *ClickhouseDB) Close() error

func (*ClickhouseDB) Open

func (db *ClickhouseDB) Open(ctx context.Context) (err error)

type PostgresConfig

type PostgresConfig struct {
	Host     string `cfg:"PG_HOST" default:"localhost"`
	Port     uint16 `cfg:"PG_PORT" default:"5432"`
	User     string `cfg:"PG_USER" default:"postgres"`
	Pass     string `cfg:"PG_PASS" default:"postgres"`
	Name     string `cfg:"PG_NAME" default:"postgres"`
	MaxConns uint16 `cfg:"PG_MAX_CONNS" default:"10"`
}

type PostgresDB

type PostgresDB struct {
	*pgxpool.Pool

	Addr     string
	User     string
	Pass     string
	Name     string
	MaxConns uint16

	Logger *zap.Logger
}

func NewPostgres

func NewPostgres(cfg *PostgresConfig) *PostgresDB

func (*PostgresDB) Close

func (db *PostgresDB) Close()

func (*PostgresDB) Open

func (db *PostgresDB) Open(ctx context.Context) (err error)

Jump to

Keyboard shortcuts

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