Files
lunar-tear/server/internal/store/store.go
T
Ilya Groshev 02f511f40c Initial commit
2026-04-14 09:28:26 +03:00

28 lines
653 B
Go

package store
import (
"errors"
"time"
)
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)
UpdateUser(userId int64, mutate func(*UserState)) (UserState, error)
DefaultUserId() (int64, error)
}
type SessionRepository interface {
CreateSession(uuid string, ttl time.Duration) (UserState, SessionState, error)
ResolveUserId(sessionKey string) (int64, error)
}
type GachaRepository interface {
SnapshotCatalog() ([]GachaCatalogEntry, error)
ReplaceCatalog(entries []GachaCatalogEntry) error
}