mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-12-23 14:52:43 +00:00
invalid db.go
This commit is contained in:
parent
1aad1ef359
commit
d457c5a9d0
1 changed files with 5 additions and 8 deletions
|
|
@ -120,11 +120,10 @@ func isTableEmpty(tableName string) (bool, error) {
|
|||
|
||||
// InitDB sets up the database connection, migrates models, and runs seeders.
|
||||
func InitDB(dbPath string) error {
|
||||
dir := path.Dir(dbPath)
|
||||
err := os.MkdirAll(dir, fs.ModePerm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dir := path.Dir(dbPath)
|
||||
if err := os.MkdirAll(dir, fs.ModePerm); err != nil { return err }
|
||||
// ...
|
||||
}
|
||||
|
||||
var gormLogger logger.Interface
|
||||
|
||||
|
|
@ -170,9 +169,7 @@ func CloseDB() error {
|
|||
}
|
||||
|
||||
// GetDB returns the global GORM database instance.
|
||||
func GetDB() *gorm.DB {
|
||||
return db
|
||||
}
|
||||
func GetDB() *gorm.DB { return db }
|
||||
|
||||
// IsNotFound checks if the given error is a GORM record not found error.
|
||||
func IsNotFound(err error) bool {
|
||||
|
|
|
|||
Loading…
Reference in a new issue