sql

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DB is the database reference created by "database/sql"
	DB *db.DB
)

Functions

func Connect

func Connect(options ...module.Option) error

Connect accepts options as-needed and connects to the SQL instance depending on the driver being used. Returns an error

func Driver

func Driver(driver DBType) module.Option

func GetInfo

func GetInfo() *sqlinfo

GetInfo returns the SQL information currently in use

func Hostname

func Hostname(host string) module.Option

func Name

func Name(name string) module.Option

func Options

func Options(options string) module.Option

func Password

func Password(pass string) module.Option

func Port

func Port(port string) module.Option

func ReadConfig

func ReadConfig() (err error)

ReadConfig is a helper function that retrieves the Username, Password, Database, Host, and Port from the module Configuration file and sets the info

func Username

func Username(user string) module.Option

Types

type DBType

type DBType int

DBType specifies the type of Database available and being used.

const (
	//MYSQL is a constant to define that MySQL is being used
	MYSQL DBType = iota
	//PGSQL is a constant to define that Postgresql is being used
	PGSQL
	//SQLITE is a constant to define that sqlite3 is being used
	SQLITE
)

func (DBType) String

func (d DBType) String() string

String converts the DBType to a string

Jump to

Keyboard shortcuts

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