testutil

package
v0.0.0-...-6a21c89 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTemporaryDBAndLogger

func CreateTemporaryDBAndLogger(name string, t *testing.T) (*sql.DB, *slog.Logger, error)

func NewSlogAdapter

func NewSlogAdapter(stub *StubLogger) *slog.Logger

Types

type Logger

type Logger interface {
	Info(msg string, keysAndValues ...interface{})
}

———————————————————————————— 1. Define the abstraction used by production code ————————————————————————————

type Person

type Person struct {
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Email     string `json:"email"`
}

func GenerateFakePerson

func GenerateFakePerson() Person

func GeneratePeople

func GeneratePeople(ammount int) []Person

type StubLogger

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

———————————————————————————— 2. A lightweight stub that records calls ————————————————————————————

func (*StubLogger) Info

func (s *StubLogger) Info(msg string, keysAndValues ...interface{})

Jump to

Keyboard shortcuts

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