feat(database): add mysql support (#39)

This commit is contained in:
tardc
2021-12-23 01:34:53 +08:00
committed by GitHub
parent 8e96962791
commit 9d7a5b4598
3 changed files with 27 additions and 1 deletions
+14
View File
@@ -0,0 +1,14 @@
package database
import (
"gorm.io/driver/mysql"
"gorm.io/gorm"
)
func NewMysql(dsn string) (*gorm.DB, error) {
db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
if err != nil {
return nil, err
}
return db, nil
}