Add SQLite persistence, import-snapshot tool, and karma functionality

This commit is contained in:
Ilya Groshev
2026-04-20 09:57:47 +03:00
parent c9ad3fa4f4
commit c33e738fd5
70 changed files with 4151 additions and 833 deletions
+4 -8
View File
@@ -10,18 +10,14 @@ var ErrNotFound = errors.New("store: not found")
type Clock func() time.Time
type UserRepository interface {
EnsureUser(uuid string) (UserState, error)
SnapshotUser(userId int64) (UserState, error)
CreateUser(uuid string) (int64, error)
GetUserByUUID(uuid string) (int64, error)
LoadUser(userId int64) (UserState, error)
UpdateUser(userId int64, mutate func(*UserState)) (UserState, error)
DefaultUserId() (int64, error)
}
type SessionRepository interface {
CreateSession(uuid string, ttl time.Duration) (UserState, SessionState, error)
CreateSession(uuid string, ttl time.Duration) (SessionState, error)
ResolveUserId(sessionKey string) (int64, error)
}
type GachaRepository interface {
SnapshotCatalog() ([]GachaCatalogEntry, error)
ReplaceCatalog(entries []GachaCatalogEntry) error
}