helper

package
v1.1.4-beta Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterAllEventTypesForOneBook

func FilterAllEventTypesForOneBook(bookID uuid.UUID) Filter

func FilterAllEventTypesForOneBookOrReader

func FilterAllEventTypesForOneBookOrReader(bookID uuid.UUID, readerID uuid.UUID) Filter

func FixtureBookCopyAddedToCirculation

func FixtureBookCopyAddedToCirculation(bookID uuid.UUID, fakeClock time.Time) DomainEvent

func FixtureBookCopyLentToReader

func FixtureBookCopyLentToReader(
	bookID uuid.UUID,
	readerID uuid.UUID,
	fakeClock time.Time,
) DomainEvent

func FixtureBookCopyRemovedFromCirculation

func FixtureBookCopyRemovedFromCirculation(bookID uuid.UUID, fakeClock time.Time) DomainEvent

func FixtureBookCopyReturnedByReader

func FixtureBookCopyReturnedByReader(
	bookID uuid.UUID,
	readerID uuid.UUID,
	fakeClock time.Time,
) DomainEvent

func GivenBookCopyAddedToCirculationWasAppended

func GivenBookCopyAddedToCirculationWasAppended(
	t testing.TB,
	ctx context.Context,
	es EventStore,
	bookID uuid.UUID,
	fakeClock time.Time,
) DomainEvent

func GivenBookCopyLentToReaderWasAppended

func GivenBookCopyLentToReaderWasAppended(
	t testing.TB,
	ctx context.Context,
	es EventStore,
	bookID uuid.UUID,
	readerID uuid.UUID,
	fakeClock time.Time,
) DomainEvent

func GivenBookCopyRemovedFromCirculationWasAppended

func GivenBookCopyRemovedFromCirculationWasAppended(
	t testing.TB,
	ctx context.Context,
	es EventStore,
	bookID uuid.UUID,
	fakeClock time.Time,
) DomainEvent

func GivenBookCopyReturnedByReaderWasAppended

func GivenBookCopyReturnedByReaderWasAppended(
	t testing.TB,
	ctx context.Context,
	es EventStore,
	bookID uuid.UUID,
	readerID uuid.UUID,
	fakeClock time.Time,
) DomainEvent

func GivenSomeOtherEventsWereAppended

func GivenSomeOtherEventsWereAppended(
	t testing.TB,
	ctx context.Context,
	es EventStore,
	numEvents int,
	startFrom MaxSequenceNumberUint,
	fakeClock time.Time,
) time.Time

func GivenUniqueID

func GivenUniqueID(t testing.TB) uuid.UUID

func QueryMaxSequenceNumberBeforeAppend

func QueryMaxSequenceNumberBeforeAppend(
	t testing.TB,
	ctx context.Context,
	es EventStore,
	filter Filter,
) MaxSequenceNumberUint

func ToStorable

func ToStorable(t testing.TB, domainEvent DomainEvent) StorableEvent

func ToStorableWithMetadata

func ToStorableWithMetadata(
	t testing.TB,
	domainEvent DomainEvent,
	eventMetadata EventMetadata,
) StorableEvent

Types

type TestLogHandler

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

TestLogHandler is a slog.Handler implementation that captures log records for testing

func NewTestLogHandler

func NewTestLogHandler() *TestLogHandler

NewTestLogHandler creates a new TestLogHandler

func (*TestLogHandler) Enabled

func (h *TestLogHandler) Enabled(_ context.Context, _ slog.Level) bool

Enabled implements slog.Handler interface

func (*TestLogHandler) GetRecordCount

func (h *TestLogHandler) GetRecordCount() int

GetRecordCount returns the number of captured log records

func (*TestLogHandler) GetRecords

func (h *TestLogHandler) GetRecords() []slog.Record

GetRecords returns a copy of all captured log records

func (*TestLogHandler) Handle

func (h *TestLogHandler) Handle(_ context.Context, record slog.Record) error

Handle implements slog.Handler interface

func (*TestLogHandler) HasDebugLogWithMessage

func (h *TestLogHandler) HasDebugLogWithMessage(message string) bool

HasDebugLogWithMessage checks if there's a debug-level log record containing the specified message

func (*TestLogHandler) Reset

func (h *TestLogHandler) Reset()

Reset clears all captured log records

func (*TestLogHandler) WithAttrs

func (h *TestLogHandler) WithAttrs(_ []slog.Attr) slog.Handler

WithAttrs implements slog.Handler interface

func (*TestLogHandler) WithGroup

func (h *TestLogHandler) WithGroup(_ string) slog.Handler

WithGroup implements slog.Handler interface

type TimingCollector

type TimingCollector struct {
	QueryTime     *time.Duration
	UnmarshalTime *time.Duration
	BusinessTime  *time.Duration
	AppendTime    *time.Duration
}

TimingCollector collects timing measurements during benchmark operations for detailed performance analysis.

func NewTimingCollector

func NewTimingCollector(queryTime, unmarshalTime, businessTime, appendTime *time.Duration) TimingCollector

NewTimingCollector creates a new TimingCollector with pointers to duration variables that will accumulate timing measurements.

func (TimingCollector) RecordAppend

func (t TimingCollector) RecordAppend(duration time.Duration)

func (TimingCollector) RecordBusiness

func (t TimingCollector) RecordBusiness(duration time.Duration)

func (TimingCollector) RecordQuery

func (t TimingCollector) RecordQuery(duration time.Duration)

func (TimingCollector) RecordUnmarshal

func (t TimingCollector) RecordUnmarshal(duration time.Duration)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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