MCPcopy Create free account
hub / github.com/riverqueue/river / WorkContext

Function WorkContext

rivertest/rivertest.go:616–618  ·  view source on GitHub ↗

WorkContext returns a realistic context that can be used to test JobArgs.Work implementations. In particular, adds a client to the context so that river.ClientFromContext is usable in the test suite.

(ctx context.Context, client *river.Client[TTx])

Source from the content-addressed store, hash-verified

614// In particular, adds a client to the context so that river.ClientFromContext is
615// usable in the test suite.
616func WorkContext[TTx any](ctx context.Context, client *river.Client[TTx]) context.Context {
617 return context.WithValue(ctx, rivercommon.ContextKeyClient{}, client)
618}

Callers 2

TestWorkContextFunction · 0.85
workJobMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestWorkContextFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…