feat: room manager and pushed to login page route
This commit is contained in:
@@ -10,14 +10,14 @@ import (
|
||||
)
|
||||
|
||||
type SessionData struct {
|
||||
SessionId int64 `redis:"session_id"`
|
||||
RoomId int64 `redis:"room_id"`
|
||||
PersonId int64 `redis:"person_id"`
|
||||
SessionId int64 `redis:"session_id"`
|
||||
RoomId string `redis:"room_id"`
|
||||
PersonId int64 `redis:"person_id"`
|
||||
}
|
||||
|
||||
type SessionManagement interface {
|
||||
Get(sessionId int64) SessionData
|
||||
Save(roomId int64, personId int64) (int64, error)
|
||||
Save(roomId string, personId int64) (int64, error)
|
||||
}
|
||||
|
||||
var ctx = context.Background()
|
||||
@@ -42,7 +42,7 @@ func (redisSM RedisSM) Get(sessionId int64) SessionData {
|
||||
log.Printf("> successfully found %d %+v", sessionId, foundSession)
|
||||
return foundSession
|
||||
}
|
||||
func (redisSM RedisSM) Save(roomId int64, personId int64) (int64, error) {
|
||||
func (redisSM RedisSM) Save(roomId string, personId int64) (int64, error) {
|
||||
randId := rand.Int63()
|
||||
newSession := SessionData{
|
||||
SessionId: randId,
|
||||
@@ -63,7 +63,7 @@ func (d DummySM) Get(sessionId int64) SessionData {
|
||||
log.Printf("get dummy session by %d", sessionId)
|
||||
return SessionData{}
|
||||
}
|
||||
func (d DummySM) Save(roomId int64, personId int64) (int64, error) {
|
||||
func (d DummySM) Save(roomId string, personId int64) (int64, error) {
|
||||
log.Printf("save dummy session with %d %d", roomId, personId)
|
||||
return 1, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user