Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseError ¶
type BaseError struct {
// contains filtered or unexported fields
}
BaseError is a simple wrapper that implements the error interface and allows attaching additional context to errors returned by the library.
func NewBaseError ¶
NewBaseError creates a new BaseError that wraps an underlying error with a formatted message.
type Clock ¶
type Clock struct{}
Clock implements IClock using the real time package.
func NewRealClock ¶
func NewRealClock() *Clock
NewRealClock returns a Clock that uses the system clock.
type IClock ¶
type IClock interface {
// Get the current time
Now() time.Time
// Sleep for the given duration
Sleep(duration time.Duration)
}
IClock abstracts time functions so that the tracker can be tested with custom clocks. It can be implemented using a mock clock to run simulations.
type Ticker ¶
type Ticker struct {
// contains filtered or unexported fields
}
Ticker wraps time.Ticker to satisfy the ITicker interface.
func NewRealTicker ¶
NewRealTicker creates a ticker that ticks at the specified duration.
Click to show internal directories.
Click to hide internal directories.