backend

package module
v0.0.0-...-4060db5 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DBString to format connection string to database
	DBString = "host=%s port=%s dbname=%s user=%s password=%s sslmode=disable"
	// DBDialect for the database to use
	DBDialect = "postgres"
	// DBKey to identify the configuration JSON key
	DBKey = "db"
)

Variables

This section is empty.

Functions

func GetDB

func GetDB(config JSONConfigurationDB) (*gorm.DB, error)

GetDB to get PostgreSQL DB using GORM

Types

type JSONConfigurationDB

type JSONConfigurationDB struct {
	Host            string `json:"host"`
	Port            string `json:"port"`
	Name            string `json:"name"`
	Username        string `json:"username"`
	Password        string `json:"password"`
	MaxIdleConns    int    `json:"max_idle_conns"`
	MaxOpenConns    int    `json:"max_open_conns"`
	ConnMaxLifetime int    `json:"conn_max_lifetime"`
}

JSONConfigurationDB to hold all backend configuration values

func LoadConfiguration

func LoadConfiguration(file, key string) (JSONConfigurationDB, error)

LoadConfiguration to load the DB configuration file and assign to variables

Jump to

Keyboard shortcuts

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