faketime

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: 7 Imported by: 0

Documentation

Overview

Package faketime は時刻偽装モードの API を提供する。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API 時刻偽装モード API を表す。

func NewAPI

func NewAPI(clk *fakeclock.Clock, basePath string) *API

NewAPI API を生成して返す。

func (*API) ServeHTTP

func (s *API) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP リクエストに応じてハンドラを実行する。

type Client

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

Client 時刻偽装モード API のクライアントを表す。

func NewClient

func NewClient(client *http.Client, endpoint string) *Client

NewClient Client を生成して返す。

func (*Client) Get

func (s *Client) Get(ctx context.Context) (time.Time, error)

Get 固定されたサーバー時刻を取得する。

func (*Client) Set

func (s *Client) Set(ctx context.Context, t time.Time) error

Set サーバー時刻を t に変更する。

type ClientInterface

type ClientInterface interface {
	// Get 固定されたサーバー時刻を取得する。
	Get(ctx context.Context) (time.Time, error)
	// Set サーバー時刻を t に変更する。
	Set(ctx context.Context, t time.Time) error
}

ClientInterface 時刻偽装モード API のクライアントインターフェース。

Jump to

Keyboard shortcuts

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