build: 📦 整理构建相关的工程文件 (#64)

This commit is contained in:
2023-11-22 16:02:07 +08:00
committed by GitHub
parent b4b4f23968
commit 20195e7eaf
38 changed files with 95 additions and 134 deletions

37
scripts/gen.id.linq Normal file
View File

@ -0,0 +1,37 @@
<Query Kind="Program">
<NuGetReference>Yitter.IdGenerator</NuGetReference>
<Namespace>Yitter.IdGenerator</Namespace>
</Query>
void Main()
{
//第1步全局 初始化(应用程序启动时执行一次):
// 创建 IdGeneratorOptions 对象,可在构造函数中输入 WorkerId
var options = new IdGeneratorOptions();
// options.WorkerIdBitLength = 10; // 默认值6限定 WorkerId 最大值为2^6-1即默认最多支持64个节点。
// options.SeqBitLength = 6; // 默认值6限制每毫秒生成的ID个数。若生成速度超过5万个/秒,建议加大 SeqBitLength 到 10。
// options.BaseTime = Your_Base_Time; // 如果要兼容老系统的雪花算法此处应设置为老系统的BaseTime。
// ...... 其它参数参考 IdGeneratorOptions 定义。
// 保存参数(务必调用,否则参数设置不生效):
YitIdHelper.SetIdGenerator(options);
// 以上过程只需全局一次且应在生成ID之前完成。
//第2步生成ID
// 初始化后在任何需要生成ID的地方调用以下方法
for (int i = 0; i < 20; i++)
{
var newId = YitIdHelper.NextId();
Console.WriteLine(newId);
}
for (int i = 0; i < 20; i++)
{
Console.WriteLine(Guid.NewGuid());
}
}
// You can define other methods, fields, classes and namespaces here