Skip to content

Latest commit

 

History

History
278 lines (154 loc) · 5.09 KB

Snowyflake.md

File metadata and controls

278 lines (154 loc) · 5.09 KB

snowyflake / Snowyflake

Class: Snowyflake

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Snowyflake(__namedParameters?)

Constructor

Parameters

Name Type
__namedParameters ISnowyflakeOptions

Defined in

snowyflake.ts:61

Properties

epoch

Readonly epoch: bigint

Snowflake start epoch

Defined in

snowyflake.ts:36


latestTimestamp

Private latestTimestamp: bigint

Latest timestamp

Defined in

snowyflake.ts:56


processId

Readonly processId: bigint

Internal process ID

Defined in

snowyflake.ts:46


sequence

Private sequence: bigint = DEFAULT_SEQUENCE

Sequence increment for process

Defined in

snowyflake.ts:51


workerId

Readonly workerId: bigint

Internal worker ID

Defined in

snowyflake.ts:41

Methods

deconstruct

deconstruct(snowflake): IDeconstructedSnowflake

Deconstruct the Snowflake with local epoch

Parameters

Name Type
snowflake bigint

Returns

IDeconstructedSnowflake

Defined in

snowyflake.ts:96


generateCustomId

generateCustomId(__namedParameters): bigint

Generate a custom Snowflake

Parameters

Name Type
__namedParameters ISnowyflakeGenerateCustomIdOptions

Returns

bigint

Defined in

snowyflake.ts:105


nextId

nextId(): bigint

Generate a Snowflake

Returns

bigint

Defined in

snowyflake.ts:76


deconstruct

Static deconstruct(snowflake, __namedParameters): IDeconstructedSnowflake

Deconstruct the Snowflake

Parameters

Name Type
snowflake bigint
__namedParameters ISnowyflakeDeconstructOptions

Returns

IDeconstructedSnowflake

Defined in

snowyflake.ts:148


deconstructProcessId

Static deconstructProcessId(snowflake): bigint

Deconstruct the Snowflake processId

Parameters

Name Type
snowflake bigint

Returns

bigint

Defined in

snowyflake.ts:134


deconstructSequence

Static deconstructSequence(snowflake): bigint

Deconstruct the Snowflake sequence

Parameters

Name Type
snowflake bigint

Returns

bigint

Defined in

snowyflake.ts:141


deconstructTimestamp

Static deconstructTimestamp(snowflake, epoch): bigint

Deconstruct the Snowflake timestamp

Parameters

Name Type
snowflake bigint
epoch bigint

Returns

bigint

Defined in

snowyflake.ts:120


deconstructWorkerId

Static deconstructWorkerId(snowflake): bigint

Deconstruct the Snowflake workerId

Parameters

Name Type
snowflake bigint

Returns

bigint

Defined in

snowyflake.ts:127