|
- package room
-
- import (
- "egg-im/pkg/db"
- "egg-im/pkg/gerrors"
- "fmt"
- )
-
- const RoomSeqKey = "room_seq:%d"
-
- type roomSeqRepo struct{}
-
- var RoomSeqRepo = new(roomSeqRepo)
-
- func (*roomSeqRepo) GetNextSeq(roomId int64) (int64, error) {
- num, err := db.RedisCli.Incr(fmt.Sprintf(RoomSeqKey, roomId)).Result()
- if err != nil {
- return 0, gerrors.WrapError(err)
- }
- return num, err
- }
|