Documentation ¶
Index ¶
- Constants
- type MemberScore
- type SortedList
- func (sl *SortedList) AddBatchForStringScoreMembers(values [][]byte) error
- func (sl *SortedList) Back() *skiplist.Element
- func (sl *SortedList) CreateTime() int64
- func (sl *SortedList) Front() *skiplist.Element
- func (sl *SortedList) Init() *SortedList
- func (sl *SortedList) Len() int
- func (sl *SortedList) Range(start int, stop int) []*skiplist.Element
- func (sl *SortedList) RangeByScoreAsc(min string, max string) []*skiplist.Element
Examples ¶
Constants ¶
View Source
const ( N_INF = "-inf" P_INF = "+inf" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemberScore ¶
type MemberScore struct {
// contains filtered or unexported fields
}
type SortedList ¶
type SortedList struct {
// contains filtered or unexported fields
}
func NewSortedList ¶
func NewSortedList() *SortedList
func (*SortedList) AddBatchForStringScoreMembers ¶
func (sl *SortedList) AddBatchForStringScoreMembers(values [][]byte) error
eg: from redis zset zrange get [][]byte
func (*SortedList) Back ¶
func (sl *SortedList) Back() *skiplist.Element
Back returns the last element of list l or nil if the list is empty.
func (*SortedList) Front ¶
func (sl *SortedList) Front() *skiplist.Element
Front returns the first element of list l or nil if the list is empty.
func (*SortedList) Init ¶
func (sl *SortedList) Init() *SortedList
func (*SortedList) Len ¶
func (sl *SortedList) Len() int
func (*SortedList) RangeByScoreAsc ¶
func (sl *SortedList) RangeByScoreAsc(min string, max string) []*skiplist.Element
Example ¶
sl := NewSortedList() memberScore := [][]byte{ []byte(`111`), []byte(`1.1`), []byte(`4`), []byte(`1.4`), []byte(`4`), []byte(`1.4`), []byte(`4`), []byte(`1.4`), []byte(`4`), []byte(`1.4`), []byte(`4`), []byte(`1.4`), []byte(`2`), []byte(`1.2`), []byte(`3`), []byte(`1.3`), []byte(`1`), []byte(`1.1`), } n := len(memberScore) err := sl.AddBatchForStringScoreMembers(memberScore) m := sl.Len() println(n, m) if err != nil { return } res := sl.RangeByScoreAsc("1.0", "1.2") for _, e := range res { fmt.Println(string(e.Value.([]byte))) }
Output: 1.1 1.1 1.2
Click to show internal directories.
Click to hide internal directories.