Documentation
¶
Overview ¶
Package list implements a thread-safe doubly-linked string list similar to Redis Lists. Supports O(1) push/pop at both ends.
Index ¶
- type List
- func (l *List) ForEach(fn func(elem string) bool)
- func (l *List) LIndex(index int) (string, bool)
- func (l *List) LInsert(before bool, pivot, value string) int
- func (l *List) LLen() int
- func (l *List) LPop() (string, bool)
- func (l *List) LPos(value string, rank, count, maxLen int) []int
- func (l *List) LPush(elems ...string) int
- func (l *List) LRange(start, stop int) []string
- func (l *List) LRem(count int, value string) int
- func (l *List) LSet(index int, value string) bool
- func (l *List) LTrim(start, stop int)
- func (l *List) RPop() (string, bool)
- func (l *List) RPush(elems ...string) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type List ¶
type List struct {
// contains filtered or unexported fields
}
List is a thread-safe doubly-linked list of strings.
func (*List) LInsert ¶
LInsert inserts value before or after pivot. Returns new length or -1 if pivot not found.
func (*List) LPos ¶
LPos returns the first index of value, or -1 if not found. rank: 1-based Nth match. count: max positions to return. maxLen: max scan distance.
func (*List) LRange ¶
LRange returns elements from start to stop (inclusive). Negative indices count from end.
func (*List) LRem ¶
LRem removes up to count occurrences of value. count > 0: remove from head; count < 0: remove from tail; count = 0: remove all.