database

package
v0.0.0-...-14e87fa Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMongo

func GetMongo() *mgo.Session

func GetPostgreDb

func GetPostgreDb(postgre PostgreSystem) *sqlx.DB

func SystemConnection

func SystemConnection() map[string]interface{}

we create different types of databse connection here.

Types

type MongoHost

type MongoHost struct {
	Host string
	Port string
}

func (*MongoHost) Connect

func (m *MongoHost) Connect() *mgo.Session

type PostgreHost

type PostgreHost struct {
	Driver   string
	Database string
	Username string
	Ssl      string
	Password string
}

func (*PostgreHost) Connect

func (p *PostgreHost) Connect() *sqlx.DB

func (PostgreHost) Init

func (p PostgreHost) Init()

type PostgreSystem

type PostgreSystem interface {
	Init()
	Connect() *sqlx.DB
}

type RedisHost

type RedisHost struct {
	Address  string
	Password string
	DB       int
}

func (*RedisHost) Connect

func (self *RedisHost) Connect() (*redis.Client, error)

connect to Redis and return the connection if succesful and error if otherwise

type RedisSytem

type RedisSytem interface {
	Connect() (*redis.Client, error)
}

Jump to

Keyboard shortcuts

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