{"id":13413510,"url":"https://github.com/osamingo/indigo","last_synced_at":"2025-04-15T14:34:42.452Z","repository":{"id":54737499,"uuid":"67043953","full_name":"osamingo/indigo","owner":"osamingo","description":"A distributed unique ID generator of using Sonyflake and encoded by Base58","archived":false,"fork":false,"pushed_at":"2023-05-01T15:43:55.000Z","size":56,"stargazers_count":109,"open_issues_count":0,"forks_count":13,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-25T05:23:44.678Z","etag":null,"topics":["base58","go","id","identity","snowflake","sonyflake"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/osamingo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"osamingo","custom":"https://www.paypal.me/osamingo"}},"created_at":"2016-08-31T14:17:45.000Z","updated_at":"2024-05-29T11:56:59.000Z","dependencies_parsed_at":"2024-01-08T15:34:46.772Z","dependency_job_id":null,"html_url":"https://github.com/osamingo/indigo","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osamingo%2Findigo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osamingo%2Findigo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osamingo%2Findigo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osamingo%2Findigo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osamingo","download_url":"https://codeload.github.com/osamingo/indigo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249089517,"owners_count":21210966,"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":["base58","go","id","identity","snowflake","sonyflake"],"created_at":"2024-07-30T20:01:42.010Z","updated_at":"2025-04-15T14:34:42.446Z","avatar_url":"https://github.com/osamingo.png","language":"Go","readme":"# Indigo\n\n[![CI](https://github.com/osamingo/indigo/actions/workflows/actions.yml/badge.svg)](https://github.com/osamingo/indigo/actions/workflows/actions.yml)\n[![codecov](https://codecov.io/gh/osamingo/indigo/branch/master/graph/badge.svg)](https://codecov.io/gh/osamingo/indigo)\n[![Go Report Card](https://goreportcard.com/badge/osamingo/indigo)](https://goreportcard.com/report/osamingo/indigo)\n[![codebeat badge](https://codebeat.co/badges/3885a5d8-7db0-4162-970a-577a1bf54199)](https://codebeat.co/projects/github-com-osamingo-indigo)\n[![Maintainability](https://api.codeclimate.com/v1/badges/44865a174db0fad61812/maintainability)](https://codeclimate.com/github/osamingo/indigo/maintainability)\n[![GoDoc](https://godoc.org/github.com/osamingo/indigo?status.svg)](https://godoc.org/github.com/osamingo/indigo)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/osamingo/indigo/master/LICENSE)\n\n## About\n\n- A distributed unique ID generator of using Sonyflake and encoded by Base58.\n- ID max length is 11 characters by unsigned int64 max value.\n- An Encoder can change your original encoder ;)\n\n## Install\n\n```shell\n$ go get github.com/osamingo/indigo@latest\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/osamingo/indigo\"\n)\n\nvar g *indigo.Generator\n\nfunc init() {\n\tt := time.Unix(1257894000, 0) // 2009-11-10 23:00:00 UTC\n\tg = indigo.New(nil, indigo.StartTime(t))\n\t_, err := g.NextID()\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n}\n\nfunc main() {\n\n\twg := sync.WaitGroup{}\n\twg.Add(100)\n\tfor i := 0; i \u003c 100; i++ {\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tid, err := g.NextID()\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalln(err)\n\t\t\t} else {\n\t\t\t\tlog.Println(\"ID:\", id)\n\t\t\t}\n\t\t}()\n\t}\n\n\twg.Wait()\n}\n```\n\n## Benchmark\n\n```\n# Machine: MacBook Pro (14-inch, 2021)\n# CPU    : Apple M1 Pro\n# Memory : 32 GB\n\ngoos: darwin\ngoarch: arm64\npkg: github.com/osamingo/indigo\nBenchmarkGenerator_NextID-10        30079       39191 ns/op        7 B/op     1 allocs/op\nPASS\n```\n\n## Bibliography\n\n- [Sonyflake](https://github.com/sony/sonyflake) - A distributed unique ID generator inspired by Twitter's Snowflake.\n- [Base58](https://en.wikipedia.org/wiki/Base58) - Base58 is a group of binary-to-text encoding schemes used to represent large integers as alphanumeric text.\n\n## License\n\nReleased under the [MIT License](https://github.com/osamingo/indigo/blob/master/LICENSE).\n","funding_links":["https://github.com/sponsors/osamingo","https://www.paypal.me/osamingo"],"categories":["Microsoft Office","Miscellaneous","杂项","其他杂项","Uncategorized","\u003cspan id=\"其他-miscellaneous\"\u003e其他 Miscellaneous\u003c/span\u003e","其他"],"sub_categories":["Uncategorized","未分类的","Strings","暂未分类","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","暂未分类这些库被放在这里是因为其他类别似乎都不适合。","Advanced Console UIs","交流"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosamingo%2Findigo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosamingo%2Findigo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosamingo%2Findigo/lists"}