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

24 lines
413 B
Go
Executable File

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()
}