{"id":13763824,"url":"https://github.com/edwingeng/wuid","last_synced_at":"2026-01-16T21:50:47.283Z","repository":{"id":45803384,"uuid":"119120832","full_name":"edwingeng/wuid","owner":"edwingeng","description":"An extremely fast globally unique number generator.","archived":false,"fork":false,"pushed_at":"2024-01-26T13:49:14.000Z","size":215,"stargazers_count":542,"open_issues_count":2,"forks_count":48,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-08-13T18:15:32.645Z","etag":null,"topics":["guid","snowflake","uuid"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edwingeng.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-27T01:16:28.000Z","updated_at":"2025-08-09T22:56:12.000Z","dependencies_parsed_at":"2024-01-26T14:58:52.244Z","dependency_job_id":null,"html_url":"https://github.com/edwingeng/wuid","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/edwingeng/wuid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwingeng%2Fwuid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwingeng%2Fwuid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwingeng%2Fwuid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwingeng%2Fwuid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edwingeng","download_url":"https://codeload.github.com/edwingeng/wuid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwingeng%2Fwuid/sbom","scorecard":{"id":367629,"data":{"date":"2025-08-11","repo":{"name":"github.com/edwingeng/wuid","commit":"29d94c466647f2ef2880a9526e1bdd38130ba4bd"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"10 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2023-2402 / GHSA-45x7-px36-x8w8","Warn: Project is vulnerable to: GO-2024-3321 / GHSA-v778-237x-gjrc","Warn: Project is vulnerable to: GO-2025-3487 / GHSA-hcg3-q754-cr77","Warn: Project is vulnerable to: GO-2023-1988 / GHSA-2wrh-6pvc-2jm9","Warn: Project is vulnerable to: GO-2023-2102 / GHSA-4374-p667-p6c8","Warn: Project is vulnerable to: GHSA-qppj-fm5r-hxr3","Warn: Project is vulnerable to: GO-2024-2687 / GHSA-4v7x-pqxf-cx7m","Warn: Project is vulnerable to: GO-2024-3333","Warn: Project is vulnerable to: GO-2025-3503 / GHSA-qxp5-gwg8-xv66","Warn: Project is vulnerable to: GO-2025-3595 / GHSA-vvgc-356p-c3xw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T12:14:23.852Z","repository_id":45803384,"created_at":"2025-08-18T12:14:23.852Z","updated_at":"2025-08-18T12:14:23.852Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28483933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["guid","snowflake","uuid"],"created_at":"2024-08-03T15:01:00.281Z","updated_at":"2026-01-16T21:50:47.262Z","avatar_url":"https://github.com/edwingeng.png","language":"Go","readme":"# Overview\n- `WUID` is a universal unique identifier generator.\n- `WUID` is much faster than traditional UUID. Each `WUID` instance can even generate 100M unique identifiers in a single second.\n- In the nutshell, `WUID` generates 64-bit integers in sequence. The high 28 bits are loaded from a data source. By now, Redis, MySQL, MongoDB and Callback are supported.\n- The uniqueness is guaranteed as long as all `WUID` instances share a same data source or each group of them has a different section ID.\n- `WUID` automatically renews the high 28 bits when the low 36 bits are about to run out.\n- `WUID` is thread-safe, and lock free.\n- Obfuscation is supported.\n\n# Benchmarks\n```\nBenchmarkWUID           159393580          7.661 ns/op        0 B/op       0 allocs/op\nBenchmarkRand           100000000         14.95 ns/op         0 B/op       0 allocs/op\nBenchmarkTimestamp      164224915          7.359 ns/op        0 B/op       0 allocs/op\nBenchmarkUUID_V1        23629536          43.42 ns/op         0 B/op       0 allocs/op\nBenchmarkUUID_V2        29351550          43.96 ns/op         0 B/op       0 allocs/op\nBenchmarkUUID_V3         4703044         254.2 ns/op        144 B/op       4 allocs/op\nBenchmarkUUID_V4         5796310         210.0 ns/op         16 B/op       1 allocs/op\nBenchmarkUUID_V5         4051291         310.7 ns/op        168 B/op       4 allocs/op\nBenchmarkRedis              2996       38725 ns/op          160 B/op       5 allocs/op\nBenchmarkSnowflake       1000000        2092 ns/op            0 B/op       0 allocs/op\nBenchmarkULID            5660170         207.7 ns/op         16 B/op       1 allocs/op\nBenchmarkXID            49639082          26.21 ns/op         0 B/op       0 allocs/op\nBenchmarkShortID         1312386         922.2 ns/op        320 B/op      11 allocs/op\nBenchmarkKsuid          19717675          59.79 ns/op         0 B/op       0 allocs/op\n```\n\n# Getting Started\n``` bash\ngo get -u github.com/edwingeng/wuid\n```\n\n# Usages\n### Redis\n``` go\nimport \"github.com/edwingeng/wuid/redis/v8/wuid\"\n\nnewClient := func() (redis.UniversalClient, bool, error) {\n    var client redis.UniversalClient\n    // ...\n    return client, true, nil\n}\n\n// Setup\nw := NewWUID(\"alpha\", nil)\nerr := w.LoadH28FromRedis(newClient, \"wuid\")\nif err != nil {\n    panic(err)\n}\n\n// Generate\nfor i := 0; i \u003c 10; i++ {\n    fmt.Printf(\"%#016x\\n\", w.Next())\n}\n```\n\n### MySQL\n``` go\nimport \"github.com/edwingeng/wuid/mysql/wuid\"\n\nopenDB := func() (*sql.DB, bool, error) {\n    var db *sql.DB\n    // ...\n    return db, true, nil\n}\n\n// Setup\nw := NewWUID(\"alpha\", nil)\nerr := w.LoadH28FromMysql(openDB, \"wuid\")\nif err != nil {\n    panic(err)\n}\n\n// Generate\nfor i := 0; i \u003c 10; i++ {\n    fmt.Printf(\"%#016x\\n\", w.Next())\n}\n```\n\n### MongoDB\n``` go\nimport \"github.com/edwingeng/wuid/mongo/wuid\"\n\nnewClient := func() (*mongo.Client, bool, error) {\n    var client *mongo.Client\n    // ...\n    return client, true, nil\n}\n\n// Setup\nw := NewWUID(\"alpha\", nil)\nerr := w.LoadH28FromMongo(newClient, \"test\", \"wuid\", \"default\")\nif err != nil {\n    panic(err)\n}\n\n// Generate\nfor i := 0; i \u003c 10; i++ {\n    fmt.Printf(\"%#016x\\n\", w.Next())\n}\n```\n\n### Callback\n``` go\nimport \"github.com/edwingeng/wuid/callback/wuid\"\n\ncallback := func() (int64, func(), error) {\n    var h28 int64\n    // ...\n    return h28, nil, nil\n}\n\n// Setup\nw := NewWUID(\"alpha\", nil)\nerr := w.LoadH28WithCallback(callback)\nif err != nil {\n    panic(err)\n}\n\n// Generate\nfor i := 0; i \u003c 10; i++ {\n    fmt.Printf(\"%#016x\\n\", w.Next())\n}\n```\n\n# Mysql Table Creation\n``` sql\nCREATE TABLE IF NOT EXISTS `wuid` (\n    `h` int(10) NOT NULL AUTO_INCREMENT,\n    `x` tinyint(4) NOT NULL DEFAULT '0',\n    PRIMARY KEY (`x`),\n    UNIQUE KEY `h` (`h`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1;\n```\n\n# Options\n\n- `WithSection` brands a section ID on each generated number. A section ID must be in between [0, 7].\n- `WithStep` sets the step and the floor for each generated number.\n- `WithObfuscation` enables number obfuscation.\n\n# Attentions\nIt is highly recommended to pass a logger to `wuid.NewWUID` and keep an eye on the warnings that include \"renew failed\". It indicates that the low 36 bits are about to run out in hours to hundreds of hours, and the renewal program failed for some reason. `WUID` will make many renewal attempts until succeeded. \n\n# Special thanks\n- [dustinfog](https://github.com/dustinfog)\n\n# Ports\n- swift - https://github.com/ekscrypto/SwiftWUID\n","funding_links":[],"categories":["UUID","Miscellaneous","Utility","UUID`UUID 生成和操作库`","杂项","其他","\u003ca name=\"Go\"\u003e\u003c/a\u003eGo"],"sub_categories":["Utility/Miscellaneous","HTTP Clients","查询语","Fail injection","Advanced Console UIs","实用程序/Miscellaneous","交流"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedwingeng%2Fwuid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedwingeng%2Fwuid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedwingeng%2Fwuid/lists"}