database

package
v0.0.0-...-20ba6f3 Latest Latest
Warning

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

Go to latest
Published: May 20, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Db *gorm.DB

Db is the database object

Functions

func Init

func Init(cfg Config) error

Init Initializes a db connection

func Migrate

func Migrate()

Migrate executes migrations once the db is connected

Types

type Config

type Config struct {
	User     string `env:"DB_USER"`
	Password string `env:"DB_PASSWORD"`
	Port     int64  `env:"DB_PORT" envDefault:"5432"`
	Host     string `env:"DB_HOST"`
	Name     string `env:"DB_NAME"`
}

Config is the structure used to load db credentials from the environment.

Jump to

Keyboard shortcuts

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