Documentation ¶
Index ¶
- Constants
- Variables
- func Connect(dbName string) (db *gorm.DB)
- func DB(name string) (db *gorm.DB)
- func InitDB(dbNames []string)
- func InitDefaultDB()
- func InitTestDB(name string, db *gorm.DB) error
- func NewRedisClient(opt *redis.Options) *redis.Client
- func ReadDB(name string) *gorm.DB
- func ReadDefaultDB() *gorm.DB
- func ReleaseTestDB()
- func WriteDB(name string) *gorm.DB
- func WriteDefaultDB() *gorm.DB
Constants ¶
View Source
const ( DSNMainWrite = "DSN_MAIN_WRITE" DSNMainRead = "DSN_MAIN_READ" DSNSecondWrite = "DSN_SECOND_WRITE" DSNSecondRead = "DSN_SECOND_READ" )
Variables ¶
View Source
var DefaultDBs = []string{ DSNMainWrite, DSNMainRead, DSNSecondWrite, DSNSecondRead, }
Functions ¶
func InitDefaultDB ¶
func InitDefaultDB()
func InitTestDB ¶
InitTestDB will init the mock DB and lock the db so that the actual db will not be required.
func ReadDefaultDB ¶
func ReleaseTestDB ¶
func ReleaseTestDB()
ReleaseTestDB is to release the lock for other unit tests to mock db successfully.
func WriteDefaultDB ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.