mysql

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(dt DBType) error

Close a database connection

func CloseAll

func CloseAll() error

CloseAll closes all of database connections

func ConnectReader

func ConnectReader(ctx context.Context, env aveo.Env) (*sql.DB, error)

ConnectReader creates database connection for reader DB

func ConnectWriter

func ConnectWriter(ctx context.Context, env aveo.Env) (*sql.DB, error)

ConnectWriter creates database connection for writer DB

func PingDB

func PingDB(dt DBType) error

PingDB ...

Types

type Config

type Config struct {
	DBName               string `env:"DATABASE_NAME"`
	DBHost               string `env:"DATABASE_HOST"`
	DBPort               string `env:"DATABASE_PORT"`
	DBUser               string `env:"DATABASE_USER"`
	DBPassword           string `env:"DATABASE_PASSWORD"`
	DBMaxIdleConnections int    `env:"DATABASE_MAX_IDLE_CONNECTIONS"`
	DBMaxOpenConnections int    `env:"DATABASE_MAX_OPEN_CONNECTIONS"`
}

Config ...

func NewConfig

func NewConfig(ctx context.Context, env aveo.Env, dt string) Config

NewConfig creates a new Config

type DBType

type DBType string

DBType is the data type to define database type

const (

	// DriverName ...
	DriverName = "mysql"

	// TypeReader means to access reader DB
	TypeReader DBType = "READER"
	// TypeWriter means to access writer DB
	TypeWriter DBType = "WRITER"
)

Jump to

Keyboard shortcuts

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