util

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	// Now returns the current time.
	Now() time.Time
	// After waits for the duration to elapse and then sends the current time
	After(d time.Duration) <-chan time.Time
}

Clock is an interface for the time package

type MockClock

type MockClock struct {
	mock.Mock
}

MockClock implements the Clock interface using the testify mock package.

func (*MockClock) After

func (mc *MockClock) After(d time.Duration) <-chan time.Time

After waits for the duration to elapse and then sends the current time

func (*MockClock) Now

func (mc *MockClock) Now() time.Time

Now returns the current time.

type RealClock

type RealClock struct{}

RealClock implements the Clock interface using the real time package.

func (RealClock) After

func (RealClock) After(d time.Duration) <-chan time.Time

func (RealClock) Now

func (RealClock) Now() time.Time

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL