goclock

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: MIT Imports: 1 Imported by: 0

README

Go Report Card Go Docs

GoClock

A package for mocking time in Go.

Documentation

Installation
go get github.com/bearchit/goclock
Usage

Please see example/app.go and example/app_test.go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithNow

func WithNow(now time.Time) func(*Mock)

Types

type Clock

type Clock interface {
	Now() time.Time
	SetNow(now time.Time)
}

func New

func New() Clock

func NewMock

func NewMock(options ...func(*Mock)) Clock

type Mock

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

func (Mock) Now

func (c Mock) Now() time.Time

func (*Mock) SetNow

func (c *Mock) SetNow(now time.Time)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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