feat: initial commit
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"gorm.io/datatypes"
|
||||
@ -64,3 +65,16 @@ type QuizEntry struct {
|
||||
Level uint `gorm:"index"`
|
||||
Anecdote string
|
||||
}
|
||||
|
||||
func DifficultyLevel(level uint) string {
|
||||
switch level {
|
||||
case 0:
|
||||
return "Débutant"
|
||||
case 1:
|
||||
return "Confirmé"
|
||||
case 2:
|
||||
return "Expert"
|
||||
default:
|
||||
return fmt.Sprintf("Hors catégorie (%d)", level)
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ func createGetDatabase(db *gorm.DB) func(ctx context.Context) (*gorm.DB, error)
|
||||
return
|
||||
}
|
||||
|
||||
if err := db.Exec("PRAGMA journal_mode=WAL; PRAGMA encoding='UTF-8';").Error; err != nil {
|
||||
if err := db.Exec("PRAGMA journal_mode=WAL; PRAGMA busy_timeout=500; PRAGMA txlock=deferred; PRAGMA synchronous=normal; PRAGMA encoding='UTF-8';").Error; err != nil {
|
||||
migrateErr = errors.WithStack(err)
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user