clock

package
v0.0.0-...-11149d6 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package clock 時刻の固定を行えるようにするためのパッケージ。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	// Now 現在時刻を返す。
	Now() time.Time
}

Clock 現在時刻を扱うインターフェース。 時刻に基づいた処理を行う際にこのインターフェースを使用することで、 テストなどでの時刻の偽装が容易になる。

func New

func New() Clock

New 実際の時刻を扱う Clock を返す。

type RealClock

type RealClock struct{}

RealClock time.Now() による Clock 実装。

func (*RealClock) Now

func (s *RealClock) Now() time.Time

Now 現在時刻を返す。

Directories

Path Synopsis
Package fakeclock 擬似的な時刻を返す clock.Clock 実装。
Package fakeclock 擬似的な時刻を返す clock.Clock 実装。

Jump to

Keyboard shortcuts

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