contexthook

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package contexthook provides utilities for adding request-scoped testing hooks to contexts.

It allows observing internal engine behavior that are not exposed through the public API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Invoke

func Invoke[T any](ctx context.Context, v T)

Invoke calls any hooks in ctx that accept values of type T.

func With

func With[T any](
	ctx context.Context,
	fn func(T),
) context.Context

With returns a context derived from ctx that includes fn as a hook for values of type T.

fn is called when Invoke is called on the resulting context with a value of type T. If multiple hooks are added for the same type, they will be called in the order they were added.

Types

type ExecuteCommand

type ExecuteCommand struct {
	CommandEnvelope *envelopepb.Envelope
}

ExecuteCommand a hook type that is invoked when a command is executed directly via the engine's [dogma.CommandExecutor] implementation.

It is called after the command is packed into an envelope, but before the command is added to the queue.

Jump to

Keyboard shortcuts

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