添加项目文件。

This commit is contained in:
2026-05-09 17:06:30 +08:00
parent c60f5fe117
commit 720ef957d4
378 changed files with 14843 additions and 0 deletions
@@ -0,0 +1,23 @@
namespace MessageService.Domain.Tools
{
public static class StreamKeyBuilder
{
public static string Private(Guid a, Guid b)
{
// Guid 类型使用 Guid.Empty 来判断是否为无效/初始化的 ID
if (a == Guid.Empty || b == Guid.Empty)
throw new ArgumentException("IDs cannot be empty.");
// Guid 实现了 IComparable,使用 CompareTo 来保持生成 Key 的顺序一致性
return $"p:{(a.CompareTo(b) < 0 ? $"{a}_{b}" : $"{b}_{a}")}";
}
public static string Group(Guid groupId)
{
if (groupId == Guid.Empty)
throw new ArgumentException("Group ID cannot be empty.");
return $"g:{groupId}";
}
}
}