{"id":20937359,"url":"https://github.com/sword-jin/go-tinyid","last_synced_at":"2025-08-17T19:35:11.231Z","repository":{"id":141287999,"uuid":"226282830","full_name":"sword-jin/go-tinyid","owner":"sword-jin","description":"[go] ID Generator id生成器 分布式id生成系统，简单易用、高性能、高可用的id生成系统","archived":false,"fork":false,"pushed_at":"2019-12-11T03:53:55.000Z","size":31,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T08:48:05.408Z","etag":null,"topics":["distributed-systems","golang","idgenerator"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sword-jin.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}},"created_at":"2019-12-06T08:37:04.000Z","updated_at":"2025-03-17T01:47:04.000Z","dependencies_parsed_at":"2023-06-19T01:05:59.986Z","dependency_job_id":null,"html_url":"https://github.com/sword-jin/go-tinyid","commit_stats":null,"previous_names":["rrylee/go-tinyid","sword-jin/go-tinyid"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sword-jin%2Fgo-tinyid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sword-jin%2Fgo-tinyid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sword-jin%2Fgo-tinyid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sword-jin%2Fgo-tinyid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sword-jin","download_url":"https://codeload.github.com/sword-jin/go-tinyid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254036812,"owners_count":22003655,"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","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":["distributed-systems","golang","idgenerator"],"created_at":"2024-11-18T22:35:25.552Z","updated_at":"2025-05-13T22:31:06.743Z","avatar_url":"https://github.com/sword-jin.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-tinyid\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/rrylee/go-tinyid)](https://goreportcard.com/report/github.com/rrylee/go-tinyid)\n\nID Generator id生成器 分布式id生成系统，简单易用、高性能、高可用的id生成系统\n\nfork from https://github.com/didi/tinyid (golang version)\n\n### Server\n./server/build.sh\n\n```go\npackage main\n\nimport (\n\t\"github/rrylee/go-tinyid/internal\"\n\t\"github/rrylee/go-tinyid/server/http\"\n\t\"log\"\n\t\"os\"\n)\n\nfunc main() {\n\tinternal.Logger = log.New(os.Stdout, \"[tiny-id]\", 0) // your logger component\n\terr := http.Run(\"/Users/rry/Code/github/go-tinyid/server\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n\n### client 接入\n\n```go\npackage main\n\nimport (\n\t\"github/rrylee/go-tinyid/internal\"\n\t\"github/rrylee/go-tinyid/client\"\n\t\"github/rrylee/go-tinyid/client/config\"\n\t\"log\"\n\t\"os\"\n)\n\nfunc main() {\n\tinternal.Logger = log.New(os.Stdout, \"[test]\", 0)\n\tclient.Init(\u0026config.Config{\n\t\tTinyIdServer: []string{\"http://127.0.0.1:8999\"},\n\t\tTinyIdToken:  \"test\",\n\t\tTimeout:      1 * time.Second,\n\t})\n\n\tclient := \u0026client.TinyIdClient{}\n\tfor i := 0; i \u003c 100; i++ {\n\t\tfmt.Println(client.NextId(\"test\"))\n\t}\n}\n```\n\n### http 接入\n\n```bash\n$curl http://localhost:8999/tinyid/id/nextId?bizType=test\u0026batchSize=10\n${\n    \"Data\": [\n        1900091,\n        1900092,\n        1900093,\n        1900094,\n        1900095,\n        1900096,\n        1900097,\n        1900098,\n        1900099,\n        1900100\n    ],\n    \"Code\": 200,\n    \"Message\": \"\"\n}\n\n$ curl http://localhost:8999/tinyid/id/nextIdSimple?bizType=test\u0026batchSize=10\n$ 1900101,1900102,1900103,1900104,1900105,1900106,1900107,1900108,1900109,1900110\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsword-jin%2Fgo-tinyid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsword-jin%2Fgo-tinyid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsword-jin%2Fgo-tinyid/lists"}