package domain import "strings" // RedisKey represents a Redis key type with helper methods for key construction. type RedisKey string const ( ClientRedisKey RedisKey = "client" PermissionRedisKey RedisKey = "permission" RoleRedisKey RedisKey = "role" UserRoleRedisKey RedisKey = "user_role" ) // ToString converts the RedisKey to its full string representation with the member prefix. func (key RedisKey) ToString() string { return "member:" + string(key) } // With appends additional parts to the RedisKey, separated by colons. func (key RedisKey) With(s ...string) RedisKey { parts := append([]string{string(key)}, s...) return RedisKey(strings.Join(parts, ":")) } func GeClientRedisKey(id string) string { return ClientRedisKey.With(id).ToString() } func GetPermissionRedisKey(id string) string { return PermissionRedisKey.With(id).ToString() } func GetRoleRedisKeyRedisKey(id string) string { return RoleRedisKey.With(id).ToString() } func GetUserRoleRedisKey(id string) string { return UserRoleRedisKey.With(id).ToString() }