ctxtime

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware() bridgehttp.Middleware

Middleware to set time.Time which is the time when is called this handler.

This function is intended to be used within an application.

func Now

func Now(ctx context.Context) time.Time

Now returns time.Time when requested. if time.Time does not exist in context this function cause panic.

Use this function with Middleware function. In other words, this function is intended to be used within an application.

func WithTime

func WithTime(ctx context.Context, t time.Time) context.Context

WithTime returns a copy of parent in which the value associated with time.Time is val.

Use context Values only for request-scoped data that transits processes and APIs, not for passing optional parameters to functions.

Types

This section is empty.

Jump to

Keyboard shortcuts

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