woj-server/internal/service/user/version.go

19 lines
398 B
Go
Raw Normal View History

package user
import (
"context"
"fmt"
2023-07-14 21:47:11 +08:00
"git.0x7f.app/WOJ/woj-server/internal/e"
"go.uber.org/zap"
)
func (s *service) IncrVersion(uid uint) (int64, e.Status) {
version, err := s.redis.Incr(context.Background(), fmt.Sprintf("Version:%d", uid)).Result()
if err != nil {
s.log.Warn("RedisError", zap.Error(err), zap.Any("uid", uid))
return -1, e.RedisError
}
return version, e.Success
}