Documentation
ΒΆ
Index ΒΆ
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
func ReverseItems ΒΆ
func ReverseItems(items []*Item)
ReverseItems reverses a slice of Item pointers in place.
func SortItems ΒΆ
func SortItems(items []*Item, direction SortDirection)
SortItems sorts []*kv.Item by PartitionKey and RowKey in ascending or descending order.
Types ΒΆ
type BatchItem ΒΆ
type BatchItem struct {
Op BatchOp
PK lexkey.PrimaryKey
Value []byte
}
BatchItem represents an operation to perform in a batch.
type Item ΒΆ
type Item struct {
PK lexkey.PrimaryKey
Value []byte
}
Item represents a key-value pair stored in the KV store.
type KV ΒΆ
type KV interface {
Get(ctx context.Context, pk lexkey.PrimaryKey) (*Item, error)
GetBatch(ctx context.Context, keys ...lexkey.PrimaryKey) ([]*Item, error)
Insert(ctx context.Context, item *Item) error
Put(ctx context.Context, item *Item) error
Remove(ctx context.Context, pk lexkey.PrimaryKey) error
RemoveBatch(ctx context.Context, keys ...lexkey.PrimaryKey) error
RemoveRange(ctx context.Context, rangeKey lexkey.RangeKey) error
Query(ctx context.Context, queryArgs QueryArgs, sort SortDirection) ([]*Item, error)
Enumerate(ctx context.Context, queryArgs QueryArgs) enumerators.Enumerator[*Item]
Batch(ctx context.Context, items []*BatchItem) error
BatchChunks(ctx context.Context, items enumerators.Enumerator[*BatchItem], chunkSize int) error
Close() error
}
KV defines the interface for a key-value store.
type QueryArgs ΒΆ
type QueryArgs struct {
PartitionKey lexkey.LexKey
StartRowKey lexkey.LexKey
EndRowKey lexkey.LexKey
Operator QueryOperator
Limit int
}
QueryArgs defines parameters for querying the KV store.
type QueryOperator ΒΆ
type QueryOperator int
QueryOperator defines the type of query operation.
const ( Scan QueryOperator = iota Equal GreaterThan GreaterThanOrEqual LessThan LessThanOrEqual Between StartsWith )
type Queue ΒΆ
type Queue[T any] struct { // contains filtered or unexported fields }
Queue is an optimized FIFO queue with preallocation and efficient memory management.
func (*Queue[T]) Enqueue ΒΆ
func (q *Queue[T]) Enqueue(item T)
Enqueue adds an item efficiently to the end of the queue.
type SortDirection ΒΆ
type SortDirection int
SortDirection defines the sorting order for query results.
const ( Ascending SortDirection = iota Descending )
Click to show internal directories.
Click to hide internal directories.