feat: site languages, setup and site URL settings
This commit is contained in:
1 parent
0806733d5c
commit
d9158025d4
106 files changed
+10184
-56
No files matched your search
@@ -2,6 +2,7 @@ package database
|
||||
|
||||
import (
|
||||
domainUpdate "RenewCMS/internal/domain/update"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -13,7 +14,12 @@ import (
|
||||
|
||||
const DriverSQLite = "sqlite"
|
||||
|
||||
const sqliteBusyTimeoutMs = 5000
|
||||
const (
|
||||
sqliteBusyTimeoutMs = 5000
|
||||
sqliteResultBusy = 5
|
||||
sqliteResultLocked = 6
|
||||
sqlitePrimaryMask = 0xff
|
||||
)
|
||||
|
||||
type sqliteDriver struct{}
|
||||
|
||||
@@ -31,3 +37,12 @@ func (sqliteDriver) Open(file string) (*gorm.DB, error) {
|
||||
func (sqliteDriver) NewBackup(db *gorm.DB, directory string, now func() time.Time) domainUpdate.DatabaseBackup {
|
||||
return NewSQLiteBackup(db, directory, now)
|
||||
}
|
||||
|
||||
func (sqliteDriver) IsLockContention(err error) bool {
|
||||
var coded interface{ Code() int }
|
||||
if !errors.As(err, &coded) {
|
||||
return false
|
||||
}
|
||||
primary := coded.Code() & sqlitePrimaryMask
|
||||
return primary == sqliteResultBusy || primary == sqliteResultLocked
|
||||
}
|
||||
Reference in new issue
Block a user