testutil

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package testutil provides shared test fixtures and helpers for AbstractManager tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SeedRedis

func SeedRedis(ctx context.Context, t *testing.T, client *redis.Client, data map[string]string)

SeedRedis populates Redis with the given key→JSON-string map.

func SetupMiniRedis

func SetupMiniRedis(t *testing.T) (*redis.Client, *miniredis.Miniredis)

SetupMiniRedis spins up an in-memory miniredis and returns a go-redis client.

Types

type NestedContainer

type NestedContainer struct {
	User struct {
		ID   uint   `json:"id"`
		Name string `json:"name"`
	} `json:"user"`
}

NestedContainer holds a nested struct for nested-field extraction tests.

type Product

type Product struct {
	ID       uint    `json:"id"`
	Category string  `json:"category"`
	Name     string  `json:"name"`
	Price    float64 `json:"price"`
}

Product is a test model for multi-field key template tests.

type TestUser

type TestUser struct {
	ID       uint   `gorm:"primaryKey" json:"id"`
	Username string `gorm:"uniqueIndex;size:64" json:"username"`
	Email    string `json:"email"`
	Age      int    `json:"age"`
	Status   string `json:"status"`
}

TestUser mirrors the example User model for use in tests.

Jump to

Keyboard shortcuts

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