snowflake_id() = integer()
time_unit() = seconds | milli_seconds
decode_id/1 | Decode generated id to unix time, machine id and sequential number. |
generate_id/0 | Generate a uniq id. |
generate_ids/1 | Generate uniq ids, but one worker generates theses ids. |
range_ids/2 | Returns minimum and maximum ids from unixtime. |
range_ids/3 | Returns minimum and maximum ids from unixtime with time_unit(). |
stats/0 | esnowflake stats. |
to_unixtime/1 | Convert generated id to unix time (milli_seconds). |
to_unixtime/2 | Convert generated id to unix time (seconds or milli_seconds). |
unixtime_to_id/1 | Returns snowflake uniq id from unix timestamp. |
unixtime_to_id/2 | Returns snowflake uniq id from unix timestamp. |
decode_id(Id::snowflake_id()) -> {Timestamp::integer(), MachineID::integer(), Sequence::integer()}
Decode generated id to unix time, machine id and sequential number. Unit of unix time is milli_seconds. Machine id is same as esnowflake application's worker id. Sequential number is index of same timestamp and worker id,
generate_id() -> snowflake_id()
Generate a uniq id.
generate_ids(Num::integer()) -> [snowflake_id()]
Generate uniq ids, but one worker generates theses ids.
range_ids(StartTime::integer(), EndTime::integer()) -> [integer()]
Returns minimum and maximum ids from unixtime.
This range expresses min <= x <= max
.
range_ids(StartTime::integer(), EndTime::integer(), X3::time_unit()) -> [integer()]
Returns minimum and maximum ids from unixtime with time_unit().
This range expresses min <= x <= max
.
stats() -> term()
esnowflake stats
to_unixtime(Id::snowflake_id()) -> integer()
Convert generated id to unix time (milli_seconds).
to_unixtime(Id::snowflake_id(), Unit::time_unit()) -> integer()
Convert generated id to unix time (seconds or milli_seconds). The actual unix time (msec) is round down to the nearest decimal if you specified 'seconds' time unit.
unixtime_to_id(TS::integer()) -> integer()
Returns snowflake uniq id from unix timestamp.
unixtime_to_id(TS::integer(), X2::time_unit()) -> snowflake_id()
Returns snowflake uniq id from unix timestamp.
Generated by EDoc