mock

package
v0.0.0-...-d614328 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package mock implements mocks for various runtime services

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisCache

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

RedisCache implements a mock Redis cache using keys

func NewRedisCache

func NewRedisCache() (*RedisCache, error)

NewRedisCache creates a new instance of the Redis mock queue endpoint is the full URL of the Redis endpoint database is the Redis database to use queue is the name of the Redis key to keep the list at

func (*RedisCache) Connect

func (cache *RedisCache) Connect() error

Connect to a Redis instance

func (*RedisCache) Delete

func (cache *RedisCache) Delete(key string) error

Delete a key

func (*RedisCache) Disconnect

func (cache *RedisCache) Disconnect() error

Disconnect from a Redis instance

func (*RedisCache) GetFloat64

func (cache *RedisCache) GetFloat64(key string) (float64, error)

Get an float value at key

func (*RedisCache) IncrementBy

func (cache *RedisCache) IncrementBy(key string, value int64) error

IncrementBy increments the value at key by the given value

func (*RedisCache) Set

func (cache *RedisCache) Set(key string, value interface{}) error

Set a float value at key

type RedisQueue

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

RedisQueue implements a mock Redis queue using the LIST datastructure that match the queuer inerface

func NewRedisQueue

func NewRedisQueue() (*RedisQueue, error)

NewRedisQueue creates a new instance of the Redis mock queue endpoint is the full URL of the Redis endpoint database is the Redis database to use queue is the name of the Redis key to keep the list at

func (*RedisQueue) Connect

func (queue *RedisQueue) Connect() error

Connect to a Redis instance

func (*RedisQueue) CountItems

func (queue *RedisQueue) CountItems(key string) (int, error)

CountItems counts the amount of items in the given queue

func (*RedisQueue) Disconnect

func (queue *RedisQueue) Disconnect() error

Disconnect from a Redis instance

func (*RedisQueue) Fetch

func (queue *RedisQueue) Fetch(key string) ([]byte, error)

Fetch retrieves a single item from the Redis list at key and returns a byte slice of data

func (*RedisQueue) FetchMany

func (queue *RedisQueue) FetchMany(key string, count int) ([][]byte, error)

FetchMany retrieves multiple items from the Redis list at key and returns a list of byte slices up to count

func (*RedisQueue) Purge

func (queue *RedisQueue) Purge(key string) error

Purge all items from the given queue

func (*RedisQueue) Push

func (queue *RedisQueue) Push(key string, data []byte) error

Push pushes byte data onto the Redis list at key

func (*RedisQueue) PushMany

func (queue *RedisQueue) PushMany(key string, data [][]byte) error

PushMany pushes multiple items onto the queue at key

Jump to

Keyboard shortcuts

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