reCoreD-UI/database/database.go
2024-04-11 10:51:50 +08:00

20 lines
278 B
Go

package database
import (
"gorm.io/driver/mysql"
"gorm.io/gorm"
)
var Client *gorm.DB
func Connect(DSN string) error {
var err error
Client, err = gorm.Open(mysql.Open(DSN), &gorm.Config{
SkipDefaultTransaction: true,
})
if err != nil {
return err
}
return nil
}