package observeclock
Import Path
go.pact.im/x/clock/observeclock (on go.dev)
Dependency Relation
imports 3 packages, and imported by 0 packages
Involved Source Files
Package observeclock provides a clock implementation that allows observing
Schedule, Timer and Ticker method calls.
The package is intended as an alternative to mockclock for simple cases when
observing an event creation is enough to reach the desired state.
Package-Level Type Names (only one, which is exported)
Clock allows observing creation of new events on the underlying clock.Clock
instance.
Clock *clock.Clock
Clock.Scheduler clock.Scheduler
mu sync.Mutex
xs []chan struct{}
Now returns the current local time.
Unless the underlying Scheduler implements Timer, Now calls Timer with zero
duration and uses C on the returned timer to wait for the current time.
Observe returns a channel that is closed on Schedule, Timer and Ticker calls.
Schedule implements the clock.Scheduler interface.
Ticker implements the clock.TickerScheduler interface.
Timer implements the clock.TimerScheduler interface.
event triggers an observable event.
sched returns the Scheduler implementation for this clock.
*Clock : go.pact.im/x/clock.NowScheduler
*Clock : go.pact.im/x/clock.Scheduler
*Clock : go.pact.im/x/clock.TickerScheduler
*Clock : go.pact.im/x/clock.TimerScheduler
func New(s clock.Scheduler) *Clock
func NewClock(c *clock.Clock) *Clock
Package-Level Functions (total 2, both are exported)
New returns a new Clock that observes the given clock.Scheduler including
optional interface method calls.
NewClock returns a new Clock that observes the given clock.Clock.
The pages are generated with Golds v0.4.9. (GOOS=linux GOARCH=amd64)