niki/internal/initial/database.go

38 lines
1.0 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"
)
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)
}