clocks

package
v0.0.0-...-0253919 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

README

clocks

Package clocks provides code for setting up and managing clocks on contexts.

import go.pitz.tech/lib/clocks

Usage

func Extract
func Extract(ctx context.Context) clockwork.Clock

Extract pulls the clock from the provided context. If no clock is found, then the defaultClock is returned.

func Setup
func Setup(ctx context.Context) context.Context

Setup sets the defaultClock on the provided context. This can always be overridden later.

func ToContext
func ToContext(ctx context.Context, clock clockwork.Clock) context.Context

ToContext sets the clock on the provided context.

Documentation

Overview

Package clocks provides code for setting up and managing clocks on contexts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Extract

func Extract(ctx context.Context) clockwork.Clock

Extract pulls the clock from the provided context. If no clock is found, then the defaultClock is returned.

func Setup

func Setup(ctx context.Context) context.Context

Setup sets the defaultClock on the provided context. This can always be overridden later.

func ToContext

func ToContext(ctx context.Context, clock clockwork.Clock) context.Context

ToContext sets the clock on the provided context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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