db

package
v1.1.32 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnection

func NewConnection(config Config) (*gorm.DB, error)

func NewLogger added in v1.0.6

func NewLogger(config logger.Config) logger.Interface

func SetupDatabase added in v1.0.6

func SetupDatabase(database *Database) (*gorm.DB, error)

Types

type Config

type Config struct {
	DB      Database `mapstructure:"db"`
	Secrets string   `mapstructure:"secrets"`
}

type Database

type Database struct {
	Debug          bool         `mapstructure:"debug"`
	Host           string       `mapstructure:"host"`
	User           string       `mapstructure:"user"`
	Port           int          `mapstructure:"port"`
	Password       string       `mapstructure:"password"`
	Name           string       `mapstructure:"name"`
	Type           DatabaseType `mapstructure:"type"`
	MaxIdleConns   int          `mapstructure:"max_idle_conns"`
	MaxOpenConns   int          `mapstructure:"max_open_conns"`
	MaxLifetimeSec int          `mapstructure:"max_lifetime"`
	ReadTimeout    string       `mapstructure:"read_timeout"`
	WriteTimeout   string       `mapstructure:"write_timeout"`
}

type DatabaseType

type DatabaseType string
const (
	// MySQL ...
	MySQL DatabaseType = "mysql"
	// Postgres ...
	Postgres DatabaseType = "postgres"
)

Directories

Path Synopsis
rw
db

Jump to

Keyboard shortcuts

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