{"id":18718412,"url":"https://github.com/axiaoxin-com/zranking","last_synced_at":"2025-04-12T13:33:50.337Z","repository":{"id":62867761,"uuid":"562708271","full_name":"axiaoxin-com/zranking","owner":"axiaoxin-com","description":"mod: golang redis zset ranking","archived":false,"fork":false,"pushed_at":"2022-11-30T02:18:56.000Z","size":18,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-26T08:37:11.599Z","etag":null,"topics":["rank","zset"],"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/axiaoxin-com.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":"2022-11-07T04:43:03.000Z","updated_at":"2024-01-24T08:06:46.000Z","dependencies_parsed_at":"2023-01-22T17:45:44.020Z","dependency_job_id":null,"html_url":"https://github.com/axiaoxin-com/zranking","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axiaoxin-com%2Fzranking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axiaoxin-com%2Fzranking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axiaoxin-com%2Fzranking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axiaoxin-com%2Fzranking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/axiaoxin-com","download_url":"https://codeload.github.com/axiaoxin-com/zranking/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248573649,"owners_count":21126876,"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":["rank","zset"],"created_at":"2024-11-07T13:21:16.670Z","updated_at":"2025-04-12T13:33:45.328Z","avatar_url":"https://github.com/axiaoxin-com.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zranking\n\n![visitor badge](https://visitor-badge.glitch.me/badge?page_id=axiaoxin-com.zranking\u0026left_color=red\u0026right_color=green\u0026left_text=HelloVisitors)\n\n\n使用 redis zset 实现的排行榜 golang 封装\n\n## 实现原理\n\n使用redis zset，得分相同时，按时间先后进行排序；\n将zset score按十进制数拆分，score十进制数字总共固定为16位（超过16位的数会有浮点数精度导致进位的问题），\n整数部分用于表示用户排序值val，小数部分表示排行活动结束时间戳（秒）与用户排序值更新时间戳（秒）的差值deltaTs，\n小数部分的数字长度由deltaTs的数字长度确定，整数部分最大支持长度则为：16-len(deltaTs)。\n比如活动时长为10天，总时间差为864000，长度为6，则deltaTs宽度为6，不够则在前面补0。\n\n## 安装使用\n\n```\ngo get -u github.com/axiaoxin-com/zranking\n```\n\n示例：[_example/main.go](./_example/main.go) 或参考 [zranking_test.go](./zranking_test.go)\n\n\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=axiaoxin-com/zranking\u0026type=Date)](https://star-history.com/#axiaoxin-com/zranking\u0026Date)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxiaoxin-com%2Fzranking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxiaoxin-com%2Fzranking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxiaoxin-com%2Fzranking/lists"}