Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DontWait context.Context
DontWait is an expired context for use in Value.Get. Using DontWait will cause a Value.Get call to return immediately. If the value has not been set, a context.Canceled error will be returned.
Functions ¶
This section is empty.
Types ¶
type Value ¶
type Value interface { // Set this Value. Set(interface{}) // Reset clears the currently set value, reverting to the same state as if the Eventual had just // been created. Reset() // Get waits for the value to be set. If the context expires first, an error will be returned. // // This function will return immediately when called with an expired context. In this case, the // value will be returned only if it has already been set; otherwise the context error will be // returned. For convenience, see DontWait. Get(context.Context) (interface{}, error) }
Value is an eventual value, meaning that callers wishing to access the value block until it is available.
func WithDefault ¶
func WithDefault(defaultValue interface{}) Value
WithDefault creates a new value that returns the given defaultValue if a real value isn't available in time.
Click to show internal directories.
Click to hide internal directories.