aboutsummaryrefslogtreecommitdiff
path: root/user/state.go
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2026-03-08 13:38:10 +0100
committerAnhgelus Morhtuuzh <william@herges.fr>2026-03-08 13:38:10 +0100
commitddd6306752186c149f8ad3bf2f59b5428cf01296 (patch)
tree0e40562ef636a9a76cc298e8695cc04abbdcfda5 /user/state.go
parent88e1b886e5471552c055374f71d848d3a3dcb4b6 (diff)
feat(db): run migrations
Diffstat (limited to 'user/state.go')
-rw-r--r--user/state.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/user/state.go b/user/state.go
index 9f1c90e..f2bfa5c 100644
--- a/user/state.go
+++ b/user/state.go
@@ -2,6 +2,7 @@ package user
import (
"context"
+ "database/sql"
"errors"
"fmt"
"math"
@@ -11,7 +12,6 @@ import (
"git.anhgelus.world/anhgelus/les-copaings-bot/common"
"github.com/nyttikord/avl"
"github.com/nyttikord/gokord/state"
- "gorm.io/gorm"
)
var ErrSyncingUnsavedData = errors.New("trying to sync unsaved data")
@@ -141,15 +141,15 @@ type State struct {
storage *state.AVLStorage[string, CopaingCached]
}
-func NewState(db *gorm.DB) *State {
+func NewState(db *sql.DB) *State {
state := &State{
storage: state.WrapAVLAsStorage(avl.NewKeyString[CopaingCached]()),
}
var cs []*Copaing
- err := db.Find(&cs).Error
+ /*err := db.Find(&cs).Error
if err != nil {
panic(err)
- }
+ }*/
for _, v := range cs {
FromCopaing(v).Save(SetState(context.Background(), state))
}