database

package
v0.0.0-...-ed02202 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host      string
	Port      string
	Username  string
	Password  string
	Database  string
	Charset   string
	ParseTime string
	Loc       string
}

Config defines database wrapper configurations will be based on development environment variables

type Database

type Database struct {
	// Dialect contains supported database dialects for Gorm
	Dialect string
	// DSN contains SQL DSN string to be used to connect a database via Gorm
	DSN string
	// Config contains database configuration reference
	Config *Config
}

Database defines a simple database wrapper for Gorm

func New

func New(dialect string) *Database

New creates a new instance of Database wrapper specifing a Gorm ORM supported dialect

func (*Database) CreateConnection

func (database *Database) CreateConnection() (db *gorm.DB, err error)

CreateConnection creates a new database connection

Jump to

Keyboard shortcuts

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