Skip to content

Snowflake

17 exports Added in v1.0.0 Source

Constructors

make

Added in v1.0.0 Source

Signature

declare function make(options: {
  readonly machineId: any;
  readonly sequence: number;
  readonly timestamp: number;
}): Snowflake;

Epoch

Signature

declare const constEpochMillis: number;

Generator

Generator

Added in v1.0.0 Source

Signature

declare class Generator extends any {
  constructor();
}

Signature

declare const layerGenerator: Layer.Layer<Generator>;

Signature

declare const makeGenerator: Effect.Effect<Snowflake.Generator>;

Models

Snowflake

Added in v1.0.0 Source

Signature

declare const Snowflake: (input: string | bigint) => Snowflake;

Snowflake

Added in v1.0.0 Source

Snowflake type

Added in v1.0.0 Source

Signature

type Snowflake = Brand.Branded<bigint, TypeId>;

Parts

dateTime

Added in v1.0.0 Source

Signature

declare function dateTime(snowflake: Snowflake): Utc;

machineId

Added in v1.0.0 Source

Signature

declare function machineId(snowflake: Snowflake): any;

sequence

Added in v1.0.0 Source

Signature

declare function sequence(snowflake: Snowflake): number;

timestamp

Added in v1.0.0 Source

Signature

declare function timestamp(snowflake: Snowflake): number;

toParts

Added in v1.0.0 Source

Signature

declare function toParts(snowflake: Snowflake): Parts;

Schemas

Signature

declare const SnowflakeFromBigInt: Schema.Schema<Snowflake, bigint>;

Signature

declare const SnowflakeFromString: Schema.Schema<Snowflake, string>;

Symbols

TypeId

Added in v1.0.0 Source

Signature

declare const TypeId: unique symbol;

TypeId type

Added in v1.0.0 Source

Signature

type TypeId = typeof TypeId;