feat: 优化web

This commit is contained in:
2026-04-23 18:58:13 +08:00
commit 544a2f3428
160 changed files with 27327 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
package db
import (
"errors"
"giter.top/smart/pkg/config"
"gorm.io/driver/postgres"
"gorm.io/gorm"
)
// pg sql 数据库连接
func NewPgSQLDB(cfg *config.Config) (*gorm.DB , error) {
db, err := gorm.Open(postgres.Open(cfg.Data.Database.DSN), &gorm.Config{})
if err != nil {
return nil, errors.New("failed to connect to postgres database")
}
return db, nil
}