ds

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	Type       util.DSType
	CreateTime int64
	UpdateTime int64
	DeleteTime int64
	ExpireTime *int64
	Version    uint64
}

func NewBase

func NewBase(tp util.DSType) *Base

func (*Base) DeleteValue

func (b *Base) DeleteValue()

func (*Base) GetBase

func (b *Base) GetBase() *Base

func (*Base) GetType

func (b *Base) GetType() util.DSType

func (*Base) IsAlive

func (b *Base) IsAlive() bool

func (*Base) IsExpired

func (b *Base) IsExpired() bool

func (*Base) SetBase

func (b *Base) SetBase(base *Base)

func (*Base) Update

func (b *Base) Update()

func (*Base) WithExpireTime

func (b *Base) WithExpireTime(delta int64)

type Bitmap

type Bitmap struct {
	Base
	// contains filtered or unexported fields
}

func MakeBitmap

func MakeBitmap() *Bitmap

func MakeBitmapFromList

func MakeBitmapFromList(list []uint64) *Bitmap

func (*Bitmap) ClearBit

func (b *Bitmap) ClearBit(num int)

func (*Bitmap) GetBit

func (b *Bitmap) GetBit(num int) int

func (*Bitmap) GetBitCount

func (b *Bitmap) GetBitCount(start, end int) (int, error)

func (*Bitmap) GetLen

func (b *Bitmap) GetLen() int

func (*Bitmap) GetValue

func (b *Bitmap) GetValue() interface{}

func (*Bitmap) SetBit

func (b *Bitmap) SetBit(num int)

func (*Bitmap) Size added in v0.0.7

func (b *Bitmap) Size() int

type BloomFilter

type BloomFilter struct {
	Base
	// contains filtered or unexported fields
}

func MakeBloomFilterFromView

func MakeBloomFilterFromView(view *util.BloomView) *BloomFilter

func MakeBloomFilterFuzzy

func MakeBloomFilterFuzzy(option BloomFilterFuzzyOption) *BloomFilter

MakeBloomFilterFuzzy 模糊创建

func MakeBloomFilterSpecific

func MakeBloomFilterSpecific(option BloomFilterSpecificOption) *BloomFilter

MakeBloomFilterSpecific 精确创建

func (*BloomFilter) Add

func (b *BloomFilter) Add(data string)

func (*BloomFilter) ClearAll

func (b *BloomFilter) ClearAll()

func (*BloomFilter) EstimateFalsePositiveRate

func (b *BloomFilter) EstimateFalsePositiveRate(n uint) float64

func (*BloomFilter) GetSize

func (b *BloomFilter) GetSize() uint64

func (*BloomFilter) GetValue

func (b *BloomFilter) GetValue() interface{}

func (*BloomFilter) Size added in v0.0.7

func (b *BloomFilter) Size() int

func (*BloomFilter) Test

func (b *BloomFilter) Test(data string) bool

type BloomFilterFuzzyOption

type BloomFilterFuzzyOption struct {
	N  uint
	Fp float64
}

type BloomFilterSpecificOption

type BloomFilterSpecificOption struct {
	M uint64
	K uint64
}

type Counter

type Counter struct {
	Base
	// contains filtered or unexported fields
}

func MakeCounter

func MakeCounter(val int64) *Counter

func (*Counter) Decr

func (c *Counter) Decr()

func (*Counter) DecrBy

func (c *Counter) DecrBy(delta int64)

func (*Counter) GetValue

func (c *Counter) GetValue() interface{}

func (*Counter) Incr

func (c *Counter) Incr()

func (*Counter) IncrBy

func (c *Counter) IncrBy(delta int64)

func (*Counter) Size added in v0.0.7

func (c *Counter) Size() int

type List

type List struct {
	Base
	// contains filtered or unexported fields
}

func MakeList

func MakeList(list []interface{}) *List

func (*List) Append

func (l *List) Append(list []interface{})

func (*List) GetElementAt

func (l *List) GetElementAt(pos int) (interface{}, error)

func (*List) GetLen

func (l *List) GetLen() int

func (*List) GetListBetween

func (l *List) GetListBetween(left int, right int) ([]interface{}, error)

func (*List) GetListEndAt

func (l *List) GetListEndAt(right int) ([]interface{}, error)

func (*List) GetListEqualToVal

func (l *List) GetListEqualToVal(val interface{}) []interface{}

func (*List) GetListStartWith

func (l *List) GetListStartWith(left int) ([]interface{}, error)

func (*List) GetValue

func (l *List) GetValue() interface{}

func (*List) LPop

func (l *List) LPop() interface{}

func (*List) LPush

func (l *List) LPush(ele interface{})

func (*List) RPop

func (l *List) RPop() interface{}

func (*List) RPush

func (l *List) RPush(ele interface{})

func (*List) RemoveAt

func (l *List) RemoveAt(idx int) error

func (*List) RemoveVal

func (l *List) RemoveVal(val interface{})

func (*List) SetAt added in v0.1.2

func (l *List) SetAt(idx int, val interface{}) error

func (*List) Size added in v0.0.7

func (l *List) Size() int

type Lock

type Lock struct {
	Base
	State     bool
	TimeLimit int64 // if hit TimeLimit, the lock will release
	Guid      string
	// contains filtered or unexported fields
}

func MakeLock

func MakeLock() *Lock

func (*Lock) GetValue

func (l *Lock) GetValue() interface{}

func (*Lock) Lock

func (l *Lock) Lock(t int64, guid string) error

func (*Lock) Size added in v0.0.7

func (l *Lock) Size() int

func (*Lock) Unlock

func (l *Lock) Unlock(guid string) error

type LockView

type LockView struct {
	IsLocked bool  `json:"is_locked"`
	TimeLeft int64 `json:"time_left"`
}

type Object

type Object struct {
	Base
	// contains filtered or unexported fields
}

func MakeObject

func MakeObject(object map[string]interface{}) *Object

func (*Object) DeleteFieldByKey added in v0.1.1

func (o *Object) DeleteFieldByKey(key string)

func (*Object) GetFieldByKey

func (o *Object) GetFieldByKey(key string) interface{}

func (*Object) GetValue

func (o *Object) GetValue() interface{}

func (*Object) SetFieldByKey

func (o *Object) SetFieldByKey(key string, val interface{})

func (*Object) Size added in v0.0.7

func (o *Object) Size() int

type Set

type Set struct {
	Base
	// contains filtered or unexported fields
}

func MakeSet

func MakeSet(list []interface{}) *Set

func (*Set) Add

func (s *Set) Add(e interface{})

func (*Set) Contains

func (s *Set) Contains(e interface{}) bool

func (*Set) Diff

func (s *Set) Diff(another *Set) *Set

func (*Set) GetSize

func (s *Set) GetSize() int

func (*Set) GetValue

func (s *Set) GetValue() interface{}

func (*Set) Intersect

func (s *Set) Intersect(another *Set) *Set

func (*Set) Remove

func (s *Set) Remove(e interface{})

func (*Set) Size added in v0.0.7

func (s *Set) Size() int

func (*Set) Union

func (s *Set) Union(another *Set) *Set

type String

type String struct {
	Base
	// contains filtered or unexported fields
}

func MakeString

func MakeString(val string) *String

func (*String) GetLen

func (s *String) GetLen() int

func (*String) GetValue

func (s *String) GetValue() interface{}

func (*String) Size added in v0.0.7

func (s *String) Size() int

type ZElement

type ZElement struct {
	Val   interface{}
	Score float64
}

type ZList

type ZList struct {
	Base
	// contains filtered or unexported fields
}

ZList sorted-list

func MakeZList

func MakeZList(list []util.SlElement) *ZList

func (*ZList) Add

func (zl *ZList) Add(list []util.SlElement)

func (*ZList) GetElementAt

func (zl *ZList) GetElementAt(pos int) (*util.SlElement, error)

func (*ZList) GetLen

func (zl *ZList) GetLen() int

func (*ZList) GetListBetween

func (zl *ZList) GetListBetween(left int, right int) ([]util.SlElement, error)

GetListBetween Left-Close and Right-Open

func (*ZList) GetListEndAt

func (zl *ZList) GetListEndAt(right int) ([]util.SlElement, error)

func (*ZList) GetListInScore

func (zl *ZList) GetListInScore(min float64, max float64) ([]util.SlElement, error)

func (*ZList) GetListStartWith

func (zl *ZList) GetListStartWith(left int) ([]util.SlElement, error)

func (*ZList) GetValue

func (zl *ZList) GetValue() interface{}

func (*ZList) RemoveInScore

func (zl *ZList) RemoveInScore(min float64, max float64) error

func (*ZList) RemoveScore

func (zl *ZList) RemoveScore(score float64)

func (*ZList) RemoveScores

func (zl *ZList) RemoveScores(scores []float64)

func (*ZList) Size added in v0.0.7

func (zl *ZList) Size() int

Jump to

Keyboard shortcuts

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