@SnowId()
New in 2.0Generate Snowflake-based IDs (distributed unique)
ID GenerationSince 2.0.0
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| dcId | — | — | Datacenter ID, default 1 | |
| mId | — | — | Machine ID, default 1 |
Usage
@SnowId()Generate Snowflake ID (dcId=1, mId=1)
Example:
@SnowId()
Output:
16685359784@SnowId(arg0,arg1)Generate Snowflake ID with specified dcId and mId
Example:
@SnowId(1,1)
Output:
16685359784