Update all the shit

This commit is contained in:
Henri Burau
2024-06-07 00:07:29 +02:00
parent ddbfc32fb1
commit 18265f59df
43 changed files with 609 additions and 182 deletions

View File

@ -18,6 +18,7 @@ type Persistence interface {
DeleteCapture(context.Context, int64) error
GetRecentMapScore(context.Context, int64) (*MapScore, error)
SetMapScoreConted(context.Context, int64, bool) error
CreateMapScore(context.Context, *MapScore) error
CreateOrUpdateScores(context.Context, []Score) error
@ -105,6 +106,14 @@ func (s *SQLitePersistence) GetRecentMapScore(ctx context.Context, captureid int
return &scores[0], nil
}
func (s *SQLitePersistence) SetMapScoreConted(ctx context.Context, mapscoreid int64, counted bool) error {
mapscore := MapScore{
ID: mapscoreid,
}
_, err := s.db.NewUpdate().Model(&mapscore).WherePK().Set("counted = ?", counted).Exec(ctx)
return err
}
func (s *SQLitePersistence) CreateMapScore(ctx context.Context, mapscore *MapScore) error {
_, err := s.db.NewInsert().Model(mapscore).Exec(ctx)