https://github.com/june-it/mystack.snowflakeid
开源的轻量级生成雪花Id
https://github.com/june-it/mystack.snowflakeid
dotnet mystack snowflake snowflake-id
Last synced: about 2 months ago
JSON representation
开源的轻量级生成雪花Id
- Host: GitHub
- URL: https://github.com/june-it/mystack.snowflakeid
- Owner: june-it
- License: mit
- Created: 2024-01-02T05:28:23.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-12-18T03:21:42.000Z (5 months ago)
- Last Synced: 2025-02-01T16:09:58.517Z (4 months ago)
- Topics: dotnet, mystack, snowflake, snowflake-id
- Language: C#
- Homepage:
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MyStack.SnowflakeIdGenerator
Open-source lightweight Snowflake ID generator| nuget | stats |
| ----------- | ----------- |
| [](https://www.nuget.org/packages/MyStack.SnowflakeIdGenerator) | [](https://www.nuget.org/stats/packages/MyStack.SnowflakeIdGenerator?groupby=Version) |# Getting Started
## Add Service Support
```
services.AddSnowflakeId(configure =>
{
configure.GroupId = context.Configuration.GetValue("SnowflakeIdGenerator:GroupId");
configure.MachineId = context.Configuration.GetValue("SnowflakeIdGenerator:MachineId");
});
```## Generate a new Snowflake Id
```
var snowflakeId = ServiceProvider.GetRequiredService();
var id = snowflakeId.NewId();
```# License
MIT