init
This commit is contained in:
19
serve/orm/logic/sqlite.go
Normal file
19
serve/orm/logic/sqlite.go
Normal file
@ -0,0 +1,19 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"github.com/belief428/gorm-engine/tools"
|
||||
"gorm.io/driver/sqlite"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Sqlite struct {
|
||||
Path string
|
||||
Name string
|
||||
}
|
||||
|
||||
func (this *Sqlite) DSN() gorm.Dialector {
|
||||
if isExist, _ := tools.PathExists(this.Path); !isExist {
|
||||
_ = tools.MkdirAll(this.Path)
|
||||
}
|
||||
return sqlite.Open(this.Path + "/" + this.Name)
|
||||
}
|
Reference in New Issue
Block a user