{"id":16640005,"url":"https://github.com/hueifeng/snowflake-csharp","last_synced_at":"2025-03-16T22:31:24.311Z","repository":{"id":37796287,"uuid":"273484587","full_name":"hueifeng/snowflake-csharp","owner":"hueifeng","description":"Twitter's SnowFlake algorithm is implemented using C# language. Support on redis to determine the machine serial number, Full support of cloud native K8S.","archived":false,"fork":false,"pushed_at":"2024-08-30T06:38:24.000Z","size":214,"stargazers_count":24,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-13T07:07:52.546Z","etag":null,"topics":["csharp","distributed","kubernetes","redis","snowflake","snowflake-algorithm","twitter","unique-id"],"latest_commit_sha":null,"homepage":"","language":"C#","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/hueifeng.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":"2020-06-19T12:08:05.000Z","updated_at":"2024-08-30T06:38:27.000Z","dependencies_parsed_at":"2023-02-10T01:15:17.454Z","dependency_job_id":null,"html_url":"https://github.com/hueifeng/snowflake-csharp","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hueifeng%2Fsnowflake-csharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hueifeng%2Fsnowflake-csharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hueifeng%2Fsnowflake-csharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hueifeng%2Fsnowflake-csharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hueifeng","download_url":"https://codeload.github.com/hueifeng/snowflake-csharp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221668567,"owners_count":16860677,"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":["csharp","distributed","kubernetes","redis","snowflake","snowflake-algorithm","twitter","unique-id"],"created_at":"2024-10-12T07:07:37.547Z","updated_at":"2024-10-27T11:28:05.814Z","avatar_url":"https://github.com/hueifeng.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv\u003e \n\u003cp align=\"center\"\u003e\n    \u003cimage src=\"snowflake.png\" width=\"250\" height=\"250\"\u003e\n \u003c/p\u003e\n \u003cp align=\"center\"\u003eAn ID Generator for C# based on Snowflake Algorithm (Twitter announced).\u003c/p\u003e\n\n  \u003cp align=\"center\"\u003e\n\n\u003ca href=\"https://www.nuget.org/packages/Snowflake.CSharp\"\u003e\n      \u003cimage src=\"https://img.shields.io/nuget/v/Snowflake.CSharp.svg?style=flat-square\" alt=\"nuget\"\u003e\n\u003c/a\u003e\n    \n\u003ca href=\"https://github.com/hueifeng/snowflake-csharp/workflows/.NET%20Core/badge.svg\"\u003e\n      \u003cimage src=\"https://github.com/hueifeng/snowflake-csharp/workflows/.NET%20Core/badge.svg\" alt=\"NETCore\"\u003e\n\u003c/a\u003e\n    \n\u003ca href=\"https://www.nuget.org/stats/packages/Snowflake.CSharp?groupby=Version\"\u003e\n      \u003cimage src=\"https://img.shields.io/nuget/dt/Snowflake.CSharp.svg?style=flat-square\" alt=\"stats\"\u003e\n\u003c/a\u003e\n    \n\u003ca href=\"https://raw.githubusercontent.com/hueifeng/snowflake-csharp/master/LICENSE\"\u003e\n    \u003cimage src=\"https://img.shields.io/badge/license-Apache%202-blue.svg\" alt=\"LICENSE\"\u003e\n\u003c/a\u003e\n    \n\u003ca href=\"https://app.fossa.com/projects/git%2Bgithub.com%2Fhueifeng%2Fsnowflake-csharp?ref=badge_shield\"\u003e\n      \u003cimage src=\"https://app.fossa.com/api/projects/git%2Bgithub.com%2Fhueifeng%2Fsnowflake-csharp.svg?type=shield\" alt=\"FOSSA\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n\u003c/div\u003e\n\n\n## Description\n\nLanguage: English | [中文](README.zh-cn.md)\n\nTwitter's SnowFlake algorithm is implemented using C# language.\n\n## Installation\n\n```\nPM\u003e Install-Package Snowflake.CSharp\n```\n\n## Useage\n\n1. Specify the data center ID and machine ID.\n\n```csharp\nSnowFlake snowFlake = new SnowFlake(datacenterId:1,machineId:1);\n```\n\n2. Generate Id.\n\n```csharp\nvar id = snowFlake.NextId();\n```\n\n## Advanced\n   \nSupport Kubernetes HorizontalPodAutoscaler.\n\n1. Used in distributed.\n\n```\nPM\u003e Install-Package Snowflake.Redis.CSharp\n```\n\n2. Add the following code at ConfigureServices() method.\n\n```csharp\n\npublic void ConfigureServices(IServiceCollection services)\n{\n  services.AddSnowflakeRedisService(connectionString:\"127.0.0.1:6379,allowAdmin=true\", \n      option \n            =\u003eConfiguration.GetSection(\"snowFlake\").Bind(option)\n     );\n}\n```\n\nDistributed snowflake ID automated configuration of different machine ids.\n\n```\n\"snowFlake\": {\n  \"dataCenterId\": 1,\n  \"Name\": \"test\"\n} \n```\n\n## License\n\n[Apache](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhueifeng%2Fsnowflake-csharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhueifeng%2Fsnowflake-csharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhueifeng%2Fsnowflake-csharp/lists"}