Documentation
¶
Index ¶
- func AddContextEntry[T any](initializer func(context.Context) (T, error))
- func ContextValue[T any](ctx context.Context) T
- func DryRun(ctx context.Context) bool
- func IsAnti(r Resource) bool
- func Waiter(name string, ready func(context.Context) (bool, error)) *waitResource
- type ContainerResource
- type Context
- type ContextOption
- type Resource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddContextEntry ¶
AddContextEntry registers a new context entry for the given type T. Only one initializer may be present per type. Only the exact type T is registered, not any compatible interfaces.
It is unsafe to call this function concurrently with itself, or with any functions/methods that create or use a Context. In general, this should only be called during app initialization.
func ContextValue ¶
ContextValue retrieves a value of type T from the context, which must have been registered with AddContextEntry. If no value or initializer for the type is found, it will panic. If an initializer is found but not a value, it will also panic.
Types ¶
type ContainerResource ¶
type Context ¶
func NewContext ¶
func NewContext(ctx context.Context, opts ...ContextOption) (*Context, error)
NewContext creates a new Context with the given parent context and options.
All context entries registered with AddContextEntry will be initialized proactively, and if any fail this function will return an error.
func NewEmptyContext ¶
func NewEmptyContext(ctx context.Context, opts ...ContextOption) *Context
NewEmptyContext creates a new Context with the given parent context and options, but does not initialize any context entries. If requested, they will be initialized on demand, but if they fail in that case, it will panic.
type ContextOption ¶
type ContextOption func(*Context)
func WithDryRun ¶
func WithDryRun() ContextOption