An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

        

# MyStack.SnowflakeIdGenerator
Open-source lightweight Snowflake ID generator

| nuget | stats |
| ----------- | ----------- |
| [![nuget](https://img.shields.io/nuget/v/MyStack.SnowflakeIdGenerator.svg?style=flat-square)](https://www.nuget.org/packages/MyStack.SnowflakeIdGenerator) | [![stats](https://img.shields.io/nuget/dt/MyStack.SnowflakeIdGenerator.svg?style=flat-square)](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