list

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2022 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrListNotFound is returned when the list not found.
	ErrListNotFound = errors.New("the list not found")

	// ErrIndexOutOfRange is returned when use LSet function set index out of range.
	ErrIndexOutOfRange = errors.New("index out of range")

	// ErrCount is returned when count is error.
	ErrCount = errors.New("err count")

	// ErrMinInt is returned when count == math2.MinInt.
	ErrMinInt = errors.New("err MinInt")
)

Functions

This section is empty.

Types

type List

type List struct {
	Items map[string][][]byte
}

List represents the list.

func New

func New() *List

New returns returns a newly initialized List Object that implements the List.

func (*List) LPeek

func (l *List) LPeek(key string) (item []byte, err error)

LPeek returns the first element of the list stored at key.

func (*List) LPop

func (l *List) LPop(key string) (item []byte, err error)

LPop removes and returns the first element of the list stored at key.

func (*List) LPush

func (l *List) LPush(key string, values ...[]byte) (size int, err error)

LPush inserts all the specified values at the head of the list stored at key.

func (*List) LRange

func (l *List) LRange(key string, start, end int) (list [][]byte, err error)

LRange returns the specified elements of the list stored at key [start,end]

func (*List) LRem

func (l *List) LRem(key string, count int, value []byte) (int, error)

LRem removes the first count occurrences of elements equal to value from the list stored at key. The count argument influences the operation in the following ways: count > 0: Remove elements equal to value moving from head to tail. count < 0: Remove elements equal to value moving from tail to head. count = 0: Remove all elements equal to value.

func (*List) LRemByIndex added in v0.10.0

func (l *List) LRemByIndex(key string, indexes []int) (int, error)

LRemByIndex remove the list element at specified index

func (*List) LRemByIndexPreCheck added in v0.10.0

func (l *List) LRemByIndexPreCheck(key string, indexes []int) (int, error)

LRemByIndexPreCheck count the number of valid indexes

func (*List) LRemNum added in v0.6.0

func (l *List) LRemNum(key string, count int, value []byte) (int, error)

func (*List) LSet

func (l *List) LSet(key string, index int, value []byte) error

LSet sets the list element at index to value.

func (*List) Ltrim

func (l *List) Ltrim(key string, start, end int) error

Ltrim trim an existing list so that it will contain only the specified range of elements specified.

func (*List) RPeek

func (l *List) RPeek(key string) (item []byte, size int, err error)

RPeek returns the last element of the list stored at key.

func (*List) RPop

func (l *List) RPop(key string) (item []byte, err error)

RPop removes and returns the last element of the list stored at key.

func (*List) RPush

func (l *List) RPush(key string, values ...[]byte) (size int, err error)

RPush inserts all the specified values at the tail of the list stored at key.

func (*List) Size

func (l *List) Size(key string) (int, error)

Size returns the size of the list at given key.

Jump to

Keyboard shortcuts

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