@SnowId()

New in 2.0

Generate Snowflake-based IDs (distributed unique)

ID GenerationSince 2.0.0

Parameters

NameTypeRequiredDefaultDescription
dcIdDatacenter ID, default 1
mIdMachine 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
← Back to Function Reference