mock

package
v0.0.0-...-ed06f05 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockDB

func NewMockDB(t *testing.T) *db.Client

NewMockDB creates a new database with tables created from given models. It uses sqlite in memory as the database.

func NewMockDBConn

func NewMockDBConn(t *testing.T) *gorm.DB

func NewMockLocker

func NewMockLocker() lib.Locker

func NewMockRedis

func NewMockRedis(t *testing.T) *redis.Client

NewMockRedis returns a mock redis client for testing.

func NewMockRedisConn

func NewMockRedisConn(t *testing.T) *goredis.Client

Types

type Locker

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

Locker is a mock implementation of lib.Locker. It is used for testing.

func (*Locker) Lock

func (m *Locker) Lock(ctx context.Context, key, value string, expiresIn time.Duration) (bool, error)

func (*Locker) Unlock

func (m *Locker) Unlock(ctx context.Context, key string) (bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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