database

package
v0.0.0-...-b76ee76 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package database provides a wrapper around the sqlx package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// SQL wrapper
	SQL *sqlx.DB
)

Functions

func Connect

func Connect(i Info, connectDatabase bool) error

Connect to the database.

func Create

func Create(ci MySQLInfo) error

Create a new database with the charset and collation

func Disconnect

func Disconnect() error

Disconnect closes the MySQL connection.

func ResetConfig

func ResetConfig()

ResetConfig removes the config.

Types

type Info

type Info struct {
	// FileStorage is the path to the folder where uploaded files are stored
	FileStorage string
	// Type of database
	Type Type
	// MySQL info if used
	MySQL MySQLInfo
}

Info contains the database configurations.

func Config

func Config() Info

Config returns the config.

type MySQLInfo

type MySQLInfo struct {
	Username  string
	Password  string
	Database  string
	Charset   string
	Collation string
	Hostname  string
	Port      int
	Parameter string
}

MySQLInfo holds the details for the database connection.

type Type

type Type string

Type is the type of database.

const (
	// TypeMySQL is MySQL
	TypeMySQL Type = "MySQL"
)

Jump to

Keyboard shortcuts

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