sortedset

package
v0.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

type Element struct {
	//Member string
	Score int64
	Value interface{}
}

Element is a key-score pair

type Level

type Level struct {
	// contains filtered or unexported fields
}

Level aspect of a node

type SortedSet

type SortedSet struct {
	// contains filtered or unexported fields
}

func Make

func Make() *SortedSet

Make makes a new SortedSet

func (*SortedSet) Add

func (sortedSet *SortedSet) Add(member string, score int64, value interface{})

Add puts member into set, and returns whether has inserted new node

func (*SortedSet) ForEachByScore

func (sortedSet *SortedSet) ForEachByScore(min int64, max int64, offset int64, limit int64, desc bool, consumer func(node *node) bool)

ForEachByScore visits members which score within the given border

func (*SortedSet) Get

func (sortedSet *SortedSet) Get(member string) (element *Element, ok bool)

Get returns the given member

func (*SortedSet) Len

func (sortedSet *SortedSet) Len() int64

Len returns number of members in set

func (*SortedSet) MapLen

func (sortedSet *SortedSet) MapLen() int64

func (*SortedSet) RangeByScore

func (sortedSet *SortedSet) RangeByScore(min int64, max int64, offset int64, limit int64, desc bool) []*Element

RangeByScore returns members which score within the given border param limit: <0 means no limit

func (*SortedSet) Remove

func (sortedSet *SortedSet) Remove(member string)

func (*SortedSet) RemoveByRank

func (sortedSet *SortedSet) RemoveByRank(start int64, stop int64) int64

RemoveByRank removes member ranking within [start, stop) sort by ascending order and rank starts from 0

func (*SortedSet) RemoveByScore

func (sortedSet *SortedSet) RemoveByScore(max int64) int64

RemoveByScore removes members which timestamp < now time

func (*SortedSet) SLen

func (sortedSet *SortedSet) SLen() int32

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL