Documentation ¶
Index ¶
- func Background() sysctx.Context
- func TODO() sysctx.Context
- func TestContext(t TestingT) sysctx.Context
- func Value(ctx sysctx.Context, key interface{}) interface{}
- func WithCancel(parent sysctx.Context) (sysctx.Context, sysctx.CancelFunc)
- func WithDeadline(parent sysctx.Context, deadline time.Time) (sysctx.Context, sysctx.CancelFunc)
- func WithTestingT(ctx sysctx.Context, t TestingT) sysctx.Context
- func WithTimeout(parent sysctx.Context, timeout time.Duration) (sysctx.Context, sysctx.CancelFunc)
- func WithValue(parent sysctx.Context, key, val interface{}) sysctx.Context
- type Context
- type TestingT
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Background ¶
Background is a wrapper for sysctx.Background for ease of use (single import).
func TestContext ¶
TestContext returns a new context with the given testing object configured.
func WithCancel ¶
WithCancel is a wrapper for sysctx.WithCancel for ease of use (single import).
func WithDeadline ¶
WithDeadline is a wrapper for sysctx.WithDeadline for ease of use (single import).
func WithTestingT ¶
WithTestingT returns a context with the given testing object configured.
func WithTimeout ¶
WithTimeout is a wrapper for sysctx.WithTimeout for ease of use (single import).
Types ¶
type TestingT ¶
type TestingT interface { Log(args ...any) Cleanup(func()) TempDir() string Setenv(key, value string) zaptest.TestingT }
TestingT is a subset of the API provided by all *testing.T and *testing.B objects. It is also compatible with zaptest.TestingT. This allows us to write tests that use zaptest and our own context package.
func TestingTFromContext ¶
TestingTFromContext returns the testing object configured in the given context. If no testing object is configured, it returns nil.