🐛 fix Snowflake return bigint instead of string
This commit is contained in:
parent
ddfa1de983
commit
6df4b5e56b
@ -10,7 +10,7 @@
|
|||||||
* A container for useful snowflake-related methods.
|
* A container for useful snowflake-related methods.
|
||||||
*/
|
*/
|
||||||
export class Snowflake {
|
export class Snowflake {
|
||||||
static readonly EPOCH = 1420070400000n;
|
static readonly EPOCH = 1420070400000;
|
||||||
static INCREMENT = 0n; // max 4095
|
static INCREMENT = 0n; // max 4095
|
||||||
static processId = 0n; // max 31
|
static processId = 0n; // max 31
|
||||||
static workerId = 0n; // max 31
|
static workerId = 0n; // max 31
|
||||||
@ -87,7 +87,7 @@ export class Snowflake {
|
|||||||
var worker = Snowflake.workerId << 17n;
|
var worker = Snowflake.workerId << 17n;
|
||||||
var process = Snowflake.processId << 12n;
|
var process = Snowflake.processId << 12n;
|
||||||
var increment = Snowflake.INCREMENT++;
|
var increment = Snowflake.INCREMENT++;
|
||||||
return (time | worker | process | increment).toString(10);
|
return time | worker | process | increment;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user