{"id":18151444,"url":"https://github.com/jur0/eid","last_synced_at":"2025-10-28T02:03:14.574Z","repository":{"id":8636309,"uuid":"10283771","full_name":"jur0/eid","owner":"jur0","description":"Erlang unique id generator based on UNIX timestamp.","archived":false,"fork":false,"pushed_at":"2019-06-25T11:21:44.000Z","size":84,"stargazers_count":14,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-28T18:47:22.239Z","etag":null,"topics":["erlang","id-generator","unique-id","unix-timestamp"],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jur0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-25T12:21:30.000Z","updated_at":"2023-04-27T18:26:53.000Z","dependencies_parsed_at":"2022-08-27T10:51:36.923Z","dependency_job_id":null,"html_url":"https://github.com/jur0/eid","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jur0/eid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jur0%2Feid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jur0%2Feid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jur0%2Feid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jur0%2Feid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jur0","download_url":"https://codeload.github.com/jur0/eid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jur0%2Feid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281371793,"owners_count":26489526,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["erlang","id-generator","unique-id","unix-timestamp"],"created_at":"2024-11-02T01:07:40.619Z","updated_at":"2025-10-28T02:03:14.541Z","avatar_url":"https://github.com/jur0.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eid\n\nErlang unique ID generator.\n\n## ID types\n\nAn ID is composed of the UNIX timestamp in milliseconds (upper 48 bits) and a\nsequence number (lower 16 bits). The sequence number is used when two UNIX\ntimestamp are equal. This happens when the IDs are generated quickly (more\nthan one ID per millisecond). The sequence number makes sure that even in this\ncase the IDs are unique.\n\nThere are two formats of the IDs that can be generated:\n\n * binary - upper 48 bits is UNIX timestamp in milliseconds and the lower 16\nbits is the sequence number\n * integer - the same as binary, but expressed as a positive integer\n\nMoreover, the generated IDs are either ascending or descending. This feature\nmakes it possible to sort the IDs according to when they were generated.\n\n## Usage\n\nIn order to generate IDs, the `eid` application must be started. The API\ncontains the following functions:\n\n * `eid:get_bin()` - returns a binary ID, the generated IDs are ascending;\n * `eid:get_bin(ascend)` - the same as the previous function;\n * `eid:get_bin(descend)` - returns a binary ID, the generated IDs are\ndescending;\n * `eid:get_int()` - returns an integer ID, the generated IDs are ascending;\n * `eid:get_int(ascend)` - the same as the previous function;\n * `eid:get_int(descend)` - returns an integer id, the generated ids are\ndescending.\n\nThe functions return either `{ok, Id}` or `{error, Reason}`. The error is\nreturned when the sequence number is exceeded (which could theoretically\nhappen when there are more then 2^16 IDs generated within 1 millisecond).\n\n*The IDs are unique just on one node!*\n\n### Rebar dependency\n\nThe `deps` part of the `rebar.config` should include:\n\n```erlang\n  {deps, [\n    ...\n    {eid, {git, \"https://github.com/jur0/eid.git\", {branch, \"master\"}}},\n    ...\n  ]}.\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjur0%2Feid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjur0%2Feid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjur0%2Feid/lists"}