db

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrate

func AutoMigrate(logger *zap.Logger, dbHandle *gorm.DB) (err error)

AutoMigrate auto migrates the required models.

func Open

func Open(logger *zap.Logger, config Config, debug bool) (dbHandle *gorm.DB, err error)

Open opens a new database connection based on the given configuration.

func OpenWithRetry

func OpenWithRetry(logger *zap.Logger, config Config, debug bool) (dbHandle *gorm.DB, err error)

OpenWithRetry opens a new database connection based on the given configuration. It will retry this with an exponential backoff.

Types

type Config

type Config struct {
	Hostname    string `mapstructure:"hostname"`
	Username    string `mapstructure:"username"`
	Password    string `mapstructure:"password"`
	DBName      string `mapstructure:"dbName"`
	Port        int    `mapstructure:"port"`
	SSLMode     bool   `mapstructure:"sslMode"`
	SSLRootCert string `mapstructure:"sslRootCert"`
}

Jump to

Keyboard shortcuts

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