dbutil

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MainDatabaseWrite   = "AIRDB_MAIN_DATABASE_WRITE"
	MainDatabaseRead    = "AIRDB_MAIN_DATABASE_READ"
	SecondDatabaseWrite = "AIRDB_SECOND_DATABASE_WRITE"
	SecondDatabaseRead  = "AIRDB_SECOND_DATABASE_READ"
)

Variables

View Source
var DefaultDBs = []string{
	"MainDatabaseWrite",
	"MainDatabaseRead",
}

Functions

func DB

func DB(name string) (db *gorm.DB)

func InitDB

func InitDB(dbNames []string)

func InitDefaultDB added in v0.0.11

func InitDefaultDB()

func InitTestDB

func InitTestDB(name string, db *gorm.DB) error

InitTestDB will init the mock DB and lock the db so that the actual db will not be required.

func ReadDB

func ReadDB(name string) *gorm.DB

func ReleaseTestDB

func ReleaseTestDB()

ReleaseTestDB is to release the lock for other unit tests to mock db successfully.

func WriteDB

func WriteDB(name string) *gorm.DB

Types

This section is empty.

Jump to

Keyboard shortcuts

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