util

package
v1.19.4 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package util provides various utility functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Remember

type Remember[T any] interface {
	// Get returns nil if nothing is remembered or it has expired
	Get() *T
	// Update sets the thing to be remembered
	Update(*T)
	// Forget clears the thing that was remembered
	Forget()
}

Remember stores an item for a period of time. It is safe to share with multiple goroutines.

func NewRemember

func NewRemember[T any](duration time.Duration) Remember[T]

NewRemember creates an implementation of Remembered with the specified duration to remember the item

type TestSequence

type TestSequence interface {
	// Run runs the test function f as a subtest of t called name. It returns whether the test succeeded or failed.
	Run(name string, f func(t *testing.T)) bool
}

TestSequence is a wrapper around *testing.T that ensures that tests are run in sequence. If a test fails, all subsequent tests are skipped.

func NewTestSequence

func NewTestSequence(t *testing.T) TestSequence

NewTestSequence creates a new test sequence.

type UnboundedChan

type UnboundedChan[T any] interface {
	In() chan<- T
	Out() <-chan T
	Close()
}

UnboundedChan is a channel with an unbounded buffer

func NewUnboundedChan

func NewUnboundedChan[T any](interval time.Duration) UnboundedChan[T]

NewUnboundedChan creates a new unbounded channel

Directories

Path Synopsis
Package semver provides a model and functions for working with semantic versions.
Package semver provides a model and functions for working with semantic versions.

Jump to

Keyboard shortcuts

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