forked from ebhomengo/niki
1
0
Fork 0
niki/internal/initial/database.go

43 lines
1.2 KiB
Go
Raw Normal View History

package initial
import (
"git.gocasts.ir/ebhomengo/niki/config"
"git.gocasts.ir/ebhomengo/niki/repository/mysql"
mysqladdress "git.gocasts.ir/ebhomengo/niki/repository/mysql/address"
mysqladmin "git.gocasts.ir/ebhomengo/niki/repository/mysql/admin"
mysqlkindbox "git.gocasts.ir/ebhomengo/niki/repository/mysql/kind_box"
mysqlkindboxreq "git.gocasts.ir/ebhomengo/niki/repository/mysql/kind_box_req"
mysqlrefertime "git.gocasts.ir/ebhomengo/niki/repository/mysql/refer_time"
)
type Databases struct {
BenefactorAddressDB *mysqladdress.DB
BenefactorKindBoxReqDB *mysqlkindboxreq.DB
KindBoxRepo *mysqlkindbox.DB
AdminMysql *mysqladmin.DB
}
func InitMysql(cfg config.Config) *mysql.DB {
return mysql.New(cfg.Mysql)
}
func InitBenefactorAddressDB(db *mysql.DB) *mysqladdress.DB {
return mysqladdress.New(db)
}
func InitBenefactorKindBoxReqDB(db *mysql.DB) *mysqlkindboxreq.DB {
return mysqlkindboxreq.New(db)
}
func InitKindBoxRepo(db *mysql.DB) *mysqlkindbox.DB {
return mysqlkindbox.New(db)
}
func InitAdminMysql(db *mysql.DB) *mysqladmin.DB {
return mysqladmin.New(db)
}
func InitAdminReferTimeDB(db *mysql.DB) *mysqlrefertime.DB {
return mysqlrefertime.New(db)
}