list

package
v0.0.0-...-1c06873 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InsertOption

type InsertOption uint8

InsertOption insert option for LInsert

const (
	Before InsertOption = iota
	After
)

insert direction

type List

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

func New

func New() *List

func (*List) LIndex

func (myList *List) LIndex(key string, index int) []byte

LIndex return list 在index处的值,不存在就return nil

func (*List) LInsert

func (myList *List) LInsert(key string, option InsertOption, pivot, val []byte) int

LInsert insert val to list of key, in the front or back of pivot 如果命令成功返回插入后列表的长度, 如果没有找到pivot,返回 -1

func (*List) LLen

func (myList *List) LLen(key string) int

LLen 返回key的list的元素个数

func (*List) LPop

func (myList *List) LPop(key string) []byte

func (*List) LPush

func (myList *List) LPush(key string, val ...[]byte) int

LPush push element in the front of list

func (*List) LRange

func (myList *List) LRange(key string, start, end int) (values [][]byte)

LRange return list of key 中指定区间的元素, 如果start下标比最大下标还大, 则return空列表 如果end下标比len大,则将end修改为len - 1

func (*List) LRem

func (myList *List) LRem(key string, val []byte, count int) int

func (*List) LSet

func (myList *List) LSet(key string, index int, val []byte) bool

LSet change the element of index to val

func (*List) LTrim

func (myList *List) LTrim(key string, start, end int) bool

func (*List) RPop

func (myList *List) RPop(key string) []byte

func (*List) RPush

func (myList *List) RPush(key string, val ...[]byte) int

type Record

type Record map[string]*list.List

Jump to

Keyboard shortcuts

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