database

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MigrateDatabase

func MigrateDatabase(sqlDB *gorm.DB, config *DBConfig) error

MigrateDatabase migrates the database select district models from the models package

func SetupDatabase

func SetupDatabase(config *DBConfig) (*gorm.DB, error)

SetupDatabase sets up a database connection with DBConfig

Types

type DBConfig

type DBConfig struct {
	Host        string `json:"host,omitempty" yaml:"host,omitempty"`
	Port        int    `json:"port,omitempty" yaml:"port,omitempty"`
	Username    string `json:"username,omitempty" yaml:"username,omitempty"`
	Password    string `json:"password,omitempty" yaml:"password,omitempty"`
	DBName      string `json:"dbname,omitempty" yaml:"dbname,omitempty"`
	SSLMode     bool   `json:"ssl_mode,omitempty" yaml:"ssl_mode,omitempty"`
	AutoMigrate bool   `json:"auto_migrate,omitempty" yaml:"auto_migrate,omitempty"`
}

DBConfig object for database configuration

func NewConfig

func NewConfig() *DBConfig

NewConfig returns a new, blank database configuration

Jump to

Keyboard shortcuts

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