database

package
v0.0.0-...-e406fe1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host           string        `validate:"required" envconfig:"DB_HOST" default:"localhost"`
	Port           int           `validate:"required" envconfig:"DB_PORT" default:"3306"`
	User           string        `validate:"required" envconfig:"DB_USER"`
	Password       string        `validate:"required" envconfig:"DB_PASSWORD"`
	Name           string        `validate:"required" envconfig:"DB_NAME"`
	MaxOpenConns   int           `validate:"required" envconfig:"DB_MAX_OPEN_CONNS" default:"25"`
	MaxIdleConns   int           `validate:"required" envconfig:"DB_MAX_IDLE_CONNS" default:"5"`
	ConnMaxLifetme time.Duration `validate:"required" envconfig:"DB_CONN_MAX_LIFETIME" default:"5m"`
}

Config represents the complete database configuration

func NewConfig

func NewConfig() (*Config, error)

NewConfig creates a new Config with default values

Jump to

Keyboard shortcuts

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