feat(database): support postgres (#43)

Co-authored-by: Li4n0 <[email protected]>
This commit is contained in:
becivells
2021-12-24 22:05:12 +08:00
committed by GitHub
co-authored by Li4n0
parent 3242a49b27
commit 8b30f83075
18 changed files with 224 additions and 51 deletions
+14
View File
@@ -0,0 +1,14 @@
package database
import (
"gorm.io/driver/postgres"
"gorm.io/gorm"
)
func NewPostgres(dsn string) (*gorm.DB, error) {
db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{})
if err != nil {
return nil, err
}
return db, nil
}