common

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DateFormat     = "2006-01-02"
	DateTimeFormat = "2006-01-02 15:04:05"
)

Functions

func FindMonthDateByTime added in v0.0.8

func FindMonthDateByTime(date time.Time) (time.Time, time.Time, error)

func FindWeekDateByTime

func FindWeekDateByTime(date time.Time) (time.Time, time.Time)

Types

type SortedSet

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

SortedSet is the final exported sorted set we can use

func NewSortedSet

func NewSortedSet() *SortedSet

NewSortedSet creates a new SortedSet and return its pointer

func (*SortedSet) Delete

func (z *SortedSet) Delete(key int64) (ok bool)

Delete removes an element from the SortedSet by its key.

func (*SortedSet) GetData

func (z *SortedSet) GetData(key int64) (data interface{}, ok bool)

GetData returns data stored in the map by its key

func (*SortedSet) GetDataByRank

func (z *SortedSet) GetDataByRank(rank int64, reverse bool) (key int64, score float64, data interface{})

GetDataByRank returns the id,score and extra data of an element which found by position in the rank. The parameter rank is the position, reverse says if in the descend rank.

func (*SortedSet) GetRank

func (z *SortedSet) GetRank(key int64, reverse bool) (rank int64, score float64, data interface{})

GetRank returns position,score and extra data of an element which found by the parameter key. The parameter reverse determines the rank is descent or ascend, true means descend and false means ascend.

func (*SortedSet) IncrBy

func (z *SortedSet) IncrBy(score float64, key int64) (float64, interface{})

IncrBy ..

func (*SortedSet) Length

func (z *SortedSet) Length() int64

Length returns counts of elements

func (*SortedSet) Range

func (z *SortedSet) Range(start, end int64, f func(float64, int64, interface{}))

Range implements ZRANGE

func (*SortedSet) RevRange

func (z *SortedSet) RevRange(start, end int64, f func(float64, int64, interface{}))

RevRange implements ZREVRANGE

func (*SortedSet) Set

func (z *SortedSet) Set(score float64, key int64, dat interface{})

Set is used to add or update an element

Jump to

Keyboard shortcuts

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