database

package
v0.0.0-...-a63f1f6 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BoltDB *bolt.DB     // Bolt wrapper
	Mongo  *mgo.Session // Mongo wrapper
	Sql    *sqlx.DB     // SQL wrapper

)

Functions

func CheckConnection

func CheckConnection() bool

CheckConnection returns true if MongoDB is available

func Connect

func Connect(d DatabaseInfo)

Connect to the database

func DSN

func DSN(ci MySQLInfo) string

DSN returns the Data Source Name

func Update

func Update(bucket_name string, key string, dataStruct interface{}) error

Update makes a modification to Bolt

func View

func View(bucket_name string, key string, dataStruct interface{}) error

View retrieves a record in Bolt

Types

type BoltInfo

type BoltInfo struct {
	Path string
}

BoltInfo is the details for the database connection

type DatabaseInfo

type DatabaseInfo struct {
	Type    DatabaseType
	MySQL   MySQLInfo
	Bolt    BoltInfo
	MongoDB MongoDBInfo
}

func ReadConfig

func ReadConfig() DatabaseInfo

ReadConfig returns the database information

type DatabaseType

type DatabaseType string
const (
	TypeBolt    DatabaseType = "Bolt"
	TypeMongoDB DatabaseType = "MongoDB"
	TypeMySQL   DatabaseType = "MySQL"
)

type MongoDBInfo

type MongoDBInfo struct {
	URL      string
	Database string
}

MongoDBInfo is the details for the database connection

type MySQLInfo

type MySQLInfo struct {
	Username  string
	Password  string
	Name      string
	Hostname  string
	Port      int
	Parameter string
}

MySQLInfo is the details for the database connection

Jump to

Keyboard shortcuts

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