2024-04-03 09:05:12 +00:00
|
|
|
package database
|
|
|
|
|
|
|
|
import (
|
|
|
|
"gorm.io/driver/mysql"
|
|
|
|
"gorm.io/gorm"
|
|
|
|
)
|
|
|
|
|
2024-04-09 08:28:18 +00:00
|
|
|
var Client *gorm.DB
|
|
|
|
|
|
|
|
func Connect(DSN string) error {
|
|
|
|
var err error
|
2024-04-11 02:51:50 +00:00
|
|
|
Client, err = gorm.Open(mysql.Open(DSN), &gorm.Config{
|
|
|
|
SkipDefaultTransaction: true,
|
|
|
|
})
|
2024-04-09 08:28:18 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
2024-04-03 09:05:12 +00:00
|
|
|
}
|