system

package
v0.0.0-...-834e164 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package system is a generated GoMock package.

Package system is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocalAddr

func GetLocalAddr() (rLocalAddr string, rErr error)

func RegisterAndUseDefaultClock

func RegisterAndUseDefaultClock()

func RegisterAndUseDefaultRandom

func RegisterAndUseDefaultRandom()

Types

type Clock

type Clock interface {
	Now() time.Time
	Ticker(d time.Duration) ClockTicker
	Timer(d time.Duration) ClockTimer
}

func GetClock

func GetClock() Clock

type ClockTicker

type ClockTicker interface {
	Stop()
	Reset(d time.Duration)
	GetChannel() <-chan time.Time
}

type ClockTimer

type ClockTimer interface {
	Stop() bool
	Reset(d time.Duration) bool
	GetChannel() <-chan time.Time
}

定义这两个接口的原因,是为了方便mock测试

type MockClock

type MockClock struct {
	// contains filtered or unexported fields
}

MockClock is a mock of Clock interface.

func NewMockClock

func NewMockClock(ctrl *gomock.Controller) *MockClock

NewMockClock creates a new mock instance.

func RegisterAndUseMockClock

func RegisterAndUseMockClock(mockCtl *gomock.Controller) *MockClock

func (*MockClock) EXPECT

func (m *MockClock) EXPECT() *MockClockMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClock) Now

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

Now mocks base method.

func (*MockClock) Ticker

func (m *MockClock) Ticker(d time.Duration) ClockTicker

Ticker mocks base method.

func (*MockClock) Timer

func (m *MockClock) Timer(d time.Duration) ClockTimer

Timer mocks base method.

type MockClockMockRecorder

type MockClockMockRecorder struct {
	// contains filtered or unexported fields
}

MockClockMockRecorder is the mock recorder for MockClock.

func (*MockClockMockRecorder) Now

func (mr *MockClockMockRecorder) Now() *gomock.Call

Now indicates an expected call of Now.

func (*MockClockMockRecorder) Ticker

func (mr *MockClockMockRecorder) Ticker(d interface{}) *gomock.Call

Ticker indicates an expected call of Ticker.

func (*MockClockMockRecorder) Timer

func (mr *MockClockMockRecorder) Timer(d interface{}) *gomock.Call

Timer indicates an expected call of Timer.

type MockClockTicker

type MockClockTicker struct {
	// contains filtered or unexported fields
}

MockClockTicker is a mock of ClockTicker interface.

func NewMockClockTicker

func NewMockClockTicker(ctrl *gomock.Controller) *MockClockTicker

NewMockClockTicker creates a new mock instance.

func (*MockClockTicker) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClockTicker) GetChannel

func (m *MockClockTicker) GetChannel() <-chan time.Time

GetChannel mocks base method.

func (*MockClockTicker) Reset

func (m *MockClockTicker) Reset(d time.Duration)

Reset mocks base method.

func (*MockClockTicker) Stop

func (m *MockClockTicker) Stop()

Stop mocks base method.

type MockClockTickerMockRecorder

type MockClockTickerMockRecorder struct {
	// contains filtered or unexported fields
}

MockClockTickerMockRecorder is the mock recorder for MockClockTicker.

func (*MockClockTickerMockRecorder) GetChannel

func (mr *MockClockTickerMockRecorder) GetChannel() *gomock.Call

GetChannel indicates an expected call of GetChannel.

func (*MockClockTickerMockRecorder) Reset

func (mr *MockClockTickerMockRecorder) Reset(d interface{}) *gomock.Call

Reset indicates an expected call of Reset.

func (*MockClockTickerMockRecorder) Stop

Stop indicates an expected call of Stop.

type MockClockTimer

type MockClockTimer struct {
	// contains filtered or unexported fields
}

MockClockTimer is a mock of ClockTimer interface.

func NewMockClockTimer

func NewMockClockTimer(ctrl *gomock.Controller) *MockClockTimer

NewMockClockTimer creates a new mock instance.

func (*MockClockTimer) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClockTimer) GetChannel

func (m *MockClockTimer) GetChannel() <-chan time.Time

GetChannel mocks base method.

func (*MockClockTimer) Reset

func (m *MockClockTimer) Reset(d time.Duration) bool

Reset mocks base method.

func (*MockClockTimer) Stop

func (m *MockClockTimer) Stop() bool

Stop mocks base method.

type MockClockTimerMockRecorder

type MockClockTimerMockRecorder struct {
	// contains filtered or unexported fields
}

MockClockTimerMockRecorder is the mock recorder for MockClockTimer.

func (*MockClockTimerMockRecorder) GetChannel

func (mr *MockClockTimerMockRecorder) GetChannel() *gomock.Call

GetChannel indicates an expected call of GetChannel.

func (*MockClockTimerMockRecorder) Reset

func (mr *MockClockTimerMockRecorder) Reset(d interface{}) *gomock.Call

Reset indicates an expected call of Reset.

func (*MockClockTimerMockRecorder) Stop

Stop indicates an expected call of Stop.

type MockRandom

type MockRandom struct {
	// contains filtered or unexported fields
}

MockRandom is a mock of Random interface.

func NewMockRandom

func NewMockRandom(ctrl *gomock.Controller) *MockRandom

NewMockRandom creates a new mock instance.

func RegisterAndUseMockRandom

func RegisterAndUseMockRandom(mockCtl *gomock.Controller) *MockRandom

func (*MockRandom) EXPECT

func (m *MockRandom) EXPECT() *MockRandomMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRandom) Int

func (m *MockRandom) Int() int

Int mocks base method.

type MockRandomMockRecorder

type MockRandomMockRecorder struct {
	// contains filtered or unexported fields
}

MockRandomMockRecorder is the mock recorder for MockRandom.

func (*MockRandomMockRecorder) Int

func (mr *MockRandomMockRecorder) Int() *gomock.Call

Int indicates an expected call of Int.

type Random

type Random interface {
	Int() int
}

func GetRandom

func GetRandom() Random

type SysClockTicker

type SysClockTicker struct {
	*time.Ticker
}

func (*SysClockTicker) GetChannel

func (sys *SysClockTicker) GetChannel() <-chan time.Time

type SysClockTimer

type SysClockTimer struct {
	*time.Timer
}

系统对应的Timer

func (*SysClockTimer) GetChannel

func (sys *SysClockTimer) GetChannel() <-chan time.Time

Jump to

Keyboard shortcuts

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