Documentation ¶
Overview ¶
Package clock provides a mockable wrapper for `time.Now()`.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func After ¶
After returns time.After() or the equivalent for the clock associated with the given context.
func NewContext ¶
NewContext returns a new context with the given clock attached.
This should generally only be used in tests; production code should always use the real time.
Types ¶
type FakeClock ¶
type FakeClock struct {
// contains filtered or unexported fields
}
FakeClock provides support for mocking the current time in tests.
func NewFakeClock ¶
func NewFakeClock() *FakeClock
func (*FakeClock) AfterCalledChan ¶
func (c *FakeClock) AfterCalledChan() <-chan struct{}
AfterCalledChan returns the channel to wait for the clock's timer to be set from a call to After().
Click to show internal directories.
Click to hide internal directories.