db

package
v0.0.0-...-585f28f Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AfterCreate

func AfterCreate(db *gorm.DB)

func MongoClient

func MongoClient(cfg configs.Mongodb) *mongo.Database

func NewMysql

func NewMysql(cfg configs.MysqlConfig) *gorm.DB

func NewRedis

func NewRedis(cfg configs.RedisConfig) *redis.Client

Types

type DataSource

type DataSource struct {
	Mysql   *gorm.DB
	Mongodb *mongo.Database
	Redis   *redis.Client
}

DataSource 在使用多个db的项目中在DataSource结构体中增加Engine即可

func NewDataSource

func NewDataSource(cfg configs.Config) *DataSource

Jump to

Keyboard shortcuts

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