mirror of
https://github.com/Walter-Sparrow/lunar-tear.git
synced 2026-07-02 05:43:41 +03:00
Initial commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user