dbkit

package
v0.0.0-...-ff6a228 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DSNMainWrite   = "DSN_MAIN_WRITE"
	DSNMainRead    = "DSN_MAIN_READ"
	DSNSecondWrite = "DSN_SECOND_WRITE"
	DSNSecondRead  = "DSN_SECOND_READ"
)

Variables

Functions

func Connect

func Connect(dbName string) (db *gorm.DB)

Connection gets connection of mysql database

func DB

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

func InitDB

func InitDB(dbNames []string)

func InitDefaultDB

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 NewRedisClient

func NewRedisClient(opt *redis.Options) *redis.Client

func ReadDB

func ReadDB(name string) *gorm.DB

func ReadDefaultDB

func ReadDefaultDB() *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

func WriteDefaultDB

func WriteDefaultDB() *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