24 lines
413 B
Go
24 lines
413 B
Go
|
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()
|
||
|
}
|