saas

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TenantsDBMutex sync.Mutex
	TenantsDBMaps  = make([]*TenantInfoDB, 0)
)

Functions

func Close

func Close(dber *sql.DB)

func DbClose

func DbClose(dber *sql.DB)

func MysqlOpenDb added in v1.0.5

func MysqlOpenDb(TenantsDB sysmdel.Tenants) (tenant *gorm.DB, dber *sql.DB, mysqlStr string)

func OpenDB

func OpenDB(dsn string, maxIdleConns, maxOpenConns int) (db *gorm.DB, dber *sql.DB)

func SetDb

func SetDb(c request.Context) (tenant *gorm.DB, dber *sql.DB)

SetDb 上下文连接数据库

func SetTenantDB added in v1.0.5

func SetTenantDB(TenantId int64) (db *gorm.DB, dber *sql.DB)

SetTenantDB 上下文连接数据库

Types

type TenantInfoDB added in v1.0.5

type TenantInfoDB struct {
	DbName     string   // 数据库连接名称
	Tid        int64    // 租户id
	ConnStr    string   // 连接串
	DriverName string   // 驱动名称
	Db         *gorm.DB // 数据库连接对象
	Dber       *sql.DB  // 数据库连接对象
}

Jump to

Keyboard shortcuts

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