We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
比如我们指定Key为分数,当相同分数插入的时候会被覆盖
The text was updated successfully, but these errors were encountered:
对,Key 是唯一的,跟 map 类似。可以通过指定自定义的 Comparable 来实现你的需求,甚至模拟 Redis ZSET 的效果,可以参考 GreaterThanFunc 的例子。
Comparable
具体做法:Key 不再是一个简单的数字,而是一个 struct { Name string; Value int },自己实现一个 Comparable,仅当 Name 相同的时候才算相等,其他时候比较 Value 大小来排序。
struct { Name string; Value int }
Name
Value
Sorry, something went wrong.
No branches or pull requests
比如我们指定Key为分数,当相同分数插入的时候会被覆盖
The text was updated successfully, but these errors were encountered: