mock

package
v0.30.10 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 3 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	// Now NewTimer ...
	//
	// 标准库中的操作集合, stdClock和mockClock都有对应的实现
	//
	Now() time.Time
	NewTimer(d time.Duration) *Timer
	Sleep(d time.Duration)

	// Add Set ...
	//
	// mockClock使用以下这些函数来修改当前时间
	// 注意,如果是stdClock,则没有必要调用以下函数(调用以下函数为空实现)
	//
	Add(d time.Duration)
	Set(t time.Time)
}

func NewFakeClock

func NewFakeClock() Clock

func NewStdClock

func NewStdClock() Clock

type Timer

type Timer struct {
	C <-chan time.Time
	// contains filtered or unexported fields
}

func (*Timer) Reset

func (t *Timer) Reset(d time.Duration) bool

func (*Timer) Stop

func (t *Timer) Stop() bool

Jump to

Keyboard shortcuts

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