Documentation ¶
Index ¶
- type LinkedList
- func (l *LinkedList) GetValue() [][]byte
- func (l *LinkedList) LIndex(index int64) []byte
- func (l *LinkedList) LInsert(pivot, data []byte, before bool) int64
- func (l *LinkedList) LLen() int64
- func (l *LinkedList) LPop(count int64) [][]byte
- func (l *LinkedList) LPush(data ...[]byte)
- func (l *LinkedList) LRange(start, end int64) [][]byte
- func (l *LinkedList) LRem(count int64, value []byte) int64
- func (l *LinkedList) LSet(index int64, value []byte) bool
- func (l *LinkedList) LTrim(start, end int64)
- func (l *LinkedList) RPop(count int64) [][]byte
- func (l *LinkedList) RPush(data ...[]byte)
- func (l *LinkedList) SetValue(list [][]byte)
- func (l *LinkedList) Type() ds.ValueType
- type LinkedListG
- type Node
- type NodeG
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LinkedList ¶ added in v1.6.0
type LinkedList struct {
// contains filtered or unexported fields
}
LinkedList is a doubly linked list
func NewLinkedList ¶ added in v1.6.0
func NewLinkedList() *LinkedList
NewLinkedList returns a new doubly linked list
func (*LinkedList) GetValue ¶ added in v1.6.0
func (l *LinkedList) GetValue() [][]byte
GetValue returns the byte slice of the list
func (*LinkedList) LIndex ¶ added in v1.6.0
func (l *LinkedList) LIndex(index int64) []byte
LIndex returns the element at index in the list
func (*LinkedList) LInsert ¶ added in v1.6.0
func (l *LinkedList) LInsert(pivot, data []byte, before bool) int64
LInsert inserts the element before or after the pivot element the list length after a successful insert operation. 0 when the key doesn't exist. -1 when the pivot wasn't found.
func (*LinkedList) LLen ¶ added in v1.6.0
func (l *LinkedList) LLen() int64
LLen returns the length of the list
func (*LinkedList) LPop ¶ added in v1.6.0
func (l *LinkedList) LPop(count int64) [][]byte
LPop returns the first element of the list
func (*LinkedList) LPush ¶ added in v1.6.0
func (l *LinkedList) LPush(data ...[]byte)
LPush adds an element to the head of the list
func (*LinkedList) LRange ¶ added in v1.6.0
func (l *LinkedList) LRange(start, end int64) [][]byte
LRange returns a range of elements from the list
func (*LinkedList) LRem ¶ added in v1.6.0
func (l *LinkedList) LRem(count int64, value []byte) int64
LRem removes the first count occurrences of elements equal to value from the list Removes the first count occurrences of elements equal to element from the list stored at key. The count argument influences the operation in the following ways: count > 0: Remove elements equal to element moving from head to tail. count < 0: Remove elements equal to element moving from tail to head. count = 0: Remove all elements equal to element.
func (*LinkedList) LSet ¶ added in v1.6.0
func (l *LinkedList) LSet(index int64, value []byte) bool
LSet sets the list element at index to value
func (*LinkedList) LTrim ¶ added in v1.6.0
func (l *LinkedList) LTrim(start, end int64)
LTrim trims an existing list so that it will contain only the specified range of elements specified For example: LTRIM foobar 0 2 will modify the list stored at foobar so that only the first three elements of the list will remain. start and end can also be negative numbers indicating offsets from the end of the list, where -1 is the last element of the list, -2 the penultimate element and so on. Out of range indexes will not produce an error: if start is larger than the end of the list, or start > end, the result will be an empty list (which causes key to be removed). If end is larger than the end of the list, Redis will treat it like the last element of the list.
func (*LinkedList) RPop ¶ added in v1.6.0
func (l *LinkedList) RPop(count int64) [][]byte
RPop returns the last element of the list
func (*LinkedList) RPush ¶ added in v1.6.0
func (l *LinkedList) RPush(data ...[]byte)
RPush adds an element to the end of the list
func (*LinkedList) SetValue ¶ added in v1.6.0
func (l *LinkedList) SetValue(list [][]byte)
SetValue restores the list from the byte slice
func (*LinkedList) Type ¶ added in v1.6.0
func (l *LinkedList) Type() ds.ValueType
Type returns the type of the data structure
type LinkedListG ¶ added in v1.6.0
type LinkedListG[T any] struct { // contains filtered or unexported fields }
LinkedListG is a doubly linked list
func NewLinkedListG ¶ added in v1.6.0
func NewLinkedListG[T any]() *LinkedListG[T]
NewLinkedListG returns a new doubly linked list
func (*LinkedListG[T]) ForRange ¶ added in v1.6.0
func (l *LinkedListG[T]) ForRange(fn func(T) bool)
ForRange iterates over the list
func (*LinkedListG[T]) ForRangeNode ¶ added in v1.6.0
func (l *LinkedListG[T]) ForRangeNode(fn func(*NodeG[T]) bool)
ForRangeNode iterates over the list
func (*LinkedListG[T]) LPush ¶ added in v1.6.0
func (l *LinkedListG[T]) LPush(data ...T)
LPush adds an element to the head of the list
func (*LinkedListG[T]) RemoveNode ¶ added in v1.6.0
func (l *LinkedListG[T]) RemoveNode(n *NodeG[T])
RemoveNode removes a node from the list