core

package
v0.0.0-...-17ed6e2 Latest Latest
Warning

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

Go to latest
Published: May 24, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseDB

func CloseDB()

CloseDB closes the sqlx.DB instance. It is NOT threadsafe and should only be called via defer in main.

func CloseSQLDB

func CloseSQLDB()

CloseSQLDB closes the sql.DB instance. It is NOT threadsafe and should only be called via defer in main.

func GetDB

func GetDB() *sqlx.DB

GetDB returns a sqlx.DB.

func GetMigrate

func GetMigrate() *migrate.Instance

GetMigrate returns a migrate.Instance.

func GetSQLDB

func GetSQLDB() *sql.DB

GetSQLDB returns a sql.DB for use with packages that do not support sqlx.

func GetShell

func GetShell() *shell.App

GetShell returns a shell.App for use throughout the program

Types

type Configuration

type Configuration struct {
	Database struct {
		User     string `json:"user"`
		Name     string `json:"name"`
		Password string `json:"password"`
	}
	HashCost int    `json:"bcryptCost"`
	Address  string `json:"address"`
	Secret   string `json:"secret"`
}

Configuration stores a copy of the JSON config file within a native struct. Changes made to the struct are not propagated to the file and vise-versa.

func GetConfig

func GetConfig() *Configuration

GetConfig reads the 'config.json' file at the root of the project and returns a struct with its contents. Any fields not defined within the struct are ignored.

Jump to

Keyboard shortcuts

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