redistest

package
v0.0.0-...-93b1e75 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package redistest is used as a helper in tests that need mocked redis connection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockConn

type MockConn struct {
	mock.Mock
}

MockConn structure provides mocked redis connection implementing redigo module's Conn interface.

func NewMockConn

func NewMockConn() *MockConn

NewMockConn function creates mocked redis connection and applies default expectations.

func (*MockConn) Close

func (conn *MockConn) Close() error

Close method mocks closing the connection.

func (*MockConn) Do

func (conn *MockConn) Do(commandName string, params ...interface{}) (interface{}, error)

Do method mocks sending command to the redis server and waiting for the reply.

func (*MockConn) Err

func (conn *MockConn) Err() error

Err method mocks retrieving last connection error.

func (*MockConn) Flush

func (conn *MockConn) Flush() error

Flush method mocks flushing pending commands to the redis server.

func (*MockConn) Receive

func (conn *MockConn) Receive() (interface{}, error)

Receive method mocks receiving reply from the redis server.

func (*MockConn) Send

func (conn *MockConn) Send(commandName string, params ...interface{}) error

Send method mocks sending command to the redis server without waiting for the reply.

Jump to

Keyboard shortcuts

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