app-cloudep-comment-server/pkg/domain/redis.go

24 lines
413 B
Go
Raw Normal View History

2025-01-15 05:17:30 +00:00
package domain
import "strings"
type RedisKey string
const (
CommentRedisKey RedisKey = "comment"
)
func (key RedisKey) ToString() string {
return "comment:" + string(key)
}
func (key RedisKey) With(s ...string) RedisKey {
parts := append([]string{string(key)}, s...)
return RedisKey(strings.Join(parts, ":"))
}
func GetCommentRedisKey(id string) string {
return CommentRedisKey.With(id).ToString()
}