You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
612 B
Go

package db
import (
exhibitionConfig "exhibition-register/config"
"github.com/google/wire"
"gorm.io/gorm"
"strings"
)
var Provider = wire.NewSet(NewDB)
func NewDB() *gorm.DB {
connDci := strings.Join([]string{exhibitionConfig.Data.ExhibitionRegister.User, ":", exhibitionConfig.Data.ExhibitionRegister.Password,
"@tcp(", exhibitionConfig.Data.ExhibitionRegister.Host, ":", exhibitionConfig.Data.ExhibitionRegister.Port, ")/",
exhibitionConfig.Data.ExhibitionRegister.DbName, "?charset=utf8mb4&parseTime=true&loc=Local"}, "")
ExhibitionRegister := loadMysqlConn(connDci)
return ExhibitionRegister
}