mock_redis

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

README

db/redis/mocks

Import path: github.com/InsideGallery/core/db/redis/mocks

Package mock_redis contains generated GoMock test doubles for the legacy redis.Client interface. It is generated from db/redis/interface.go and is not a production API.

Main APIs

  • NewMockClient(ctrl) creates a generated mock client.
  • MockClient.EXPECT() returns the recorder used to set expected calls.
  • The generated mock covers Get, Set, and Stop.

Usage

package example_test

import (
	"context"
	"testing"
	"time"

	"github.com/InsideGallery/core/db/redis/mocks"
	"github.com/golang/mock/gomock"
)

func TestClient(t *testing.T) {
	ctrl := gomock.NewController(t)
	client := mock_redis.NewMockClient(ctrl)

	client.EXPECT().
		Set(context.Background(), "key", "value", time.Minute).
		Return(nil)

	if err := client.Set(context.Background(), "key", "value", time.Minute); err != nil {
		t.Fatal(err)
	}
}

Operational Notes

Do not import this package from production code. Regenerate it through the go:generate directive in db/redis/interface.go when the legacy interface changes.

Documentation

Overview

Package mock_redis is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockClient

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

MockClient is a mock of Client interface.

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance.

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClient) Get

func (m *MockClient) Get(ctx context.Context, key string) (string, bool, error)

Get mocks base method.

func (*MockClient) Set

func (m *MockClient) Set(ctx context.Context, key, value string, ttl time.Duration) error

Set mocks base method.

func (*MockClient) Stop

func (m *MockClient) Stop() error

Stop mocks base method.

type MockClientMockRecorder

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

MockClientMockRecorder is the mock recorder for MockClient.

func (*MockClientMockRecorder) Get

func (mr *MockClientMockRecorder) Get(ctx, key interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockClientMockRecorder) Set

func (mr *MockClientMockRecorder) Set(ctx, key, value, ttl interface{}) *gomock.Call

Set indicates an expected call of Set.

func (*MockClientMockRecorder) Stop

func (mr *MockClientMockRecorder) Stop() *gomock.Call

Stop indicates an expected call of Stop.

Jump to

Keyboard shortcuts

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