dict

package
v0.0.0-...-6438891 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 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 Consumer

type Consumer func(key []byte, val []byte) bool

Consumer is used to traversal dict, if it returns false the traversal will be break

type CouloyDict

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

func NewCouloyDict

func NewCouloyDict(opt CouloyDB.Options) *CouloyDict

NewCouloyDict makes a new map

func (*CouloyDict) Clear

func (cdb *CouloyDict) Clear()

func (*CouloyDict) Exist

func (cdb *CouloyDict) Exist(key string) bool

func (*CouloyDict) ForEach

func (cdb *CouloyDict) ForEach(consumer Consumer)

func (*CouloyDict) Get

func (cdb *CouloyDict) Get(key string) (val []byte, exists bool)

func (*CouloyDict) Keys

func (cdb *CouloyDict) Keys() []string

func (*CouloyDict) Len

func (cdb *CouloyDict) Len() int

func (*CouloyDict) Put

func (cdb *CouloyDict) Put(key string, val []byte) (result int)

func (*CouloyDict) PutIfAbsent

func (cdb *CouloyDict) PutIfAbsent(key string, val []byte) (result int)

func (*CouloyDict) PutIfExists

func (cdb *CouloyDict) PutIfExists(key string, val []byte) (result int)

func (*CouloyDict) RandomDistinctKeys

func (cdb *CouloyDict) RandomDistinctKeys(limit int) []string

func (*CouloyDict) RandomKeys

func (cdb *CouloyDict) RandomKeys(limit int) []string

func (*CouloyDict) Remove

func (cdb *CouloyDict) Remove(key string) (result int)

type Dict

type Dict interface {
	Get(key string) (val []byte, exists bool)
	Len() int
	Put(key string, val []byte) (result int)
	PutIfAbsent(key string, val []byte) (result int)
	PutIfExists(key string, val []byte) (result int)
	Remove(key string) (result int)
	ForEach(consumer Consumer)
	Keys() []string
	RandomKeys(limit int) []string
	RandomDistinctKeys(limit int) []string
	Clear()
	Exist(key string) bool
}

Dict is interface of a key-value data structure

Jump to

Keyboard shortcuts

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