Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

Snowflake

17 exports Since v1.0.0 Source

Constructors

Since v1.0.0

Signature

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

Epoch

Signature

declare const constEpochMillis: number

Generator

Signature

declare class Generator extends any {
constructor();
}

Signature

declare const layerGenerator: Layer.Layer<Generator>

Signature

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

Models

Signature

declare const Snowflake: (input: string | bigint) => Snowflake
Since v1.0.0

Signature

type Snowflake = Brand.Branded<bigint, TypeId>

Parts

Since v1.0.0

Signature

declare function dateTime(snowflake: Snowflake): Utc

Signature

declare function machineId(snowflake: Snowflake): any
Since v1.0.0

Signature

declare function sequence(snowflake: Snowflake): number

Signature

declare function timestamp(snowflake: Snowflake): number
Since v1.0.0

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

Since v1.0.0

Signature

declare const TypeId: unique symbol
Since v1.0.0

Signature

type TypeId = typeof TypeId