database

package
v0.0.0-...-35e313c Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DevMode  = "Dev"
	TestMode = "Test"
)

Db modes

Variables

View Source
var MongoDBName = "Store"

Functions

func Connection

func Connection(conf *config.Config, mode string) db.Session

Connection creates a new database connection based on the configuration and mode

func GenerateUniqueID

func GenerateUniqueID() string

GenerateUniqueID generates ids

func GetMongoDBClient

func GetMongoDBClient() (*mongo.Client, error)

GetMongoDBClient #

func ReInitDB

func ReInitDB()

ReInitDB re-init the database , it is dangerous function because it wipes out every data

func RedisClient

func RedisClient() *redis.Client

Types

type DataBase

type DataBase struct {
	Config *config.Config
	Mode   string
}

DataBase #

func (DataBase) Connection

func (db DataBase) Connection() db.Session

Connection create db connection

Jump to

Keyboard shortcuts

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