util

package
v1.6.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDetachedContext

func NewDetachedContext(parent context.Context) context.Context

NewDetachedContext produces a new context that has a separate cancellation mechanism from its parent. This should be used when having to continue using a context after it has been canceled, such as cleaning up Docker resources after the context has been canceled but want to keep work associated with the same trace.

Types

type Compare added in v1.2.2

type Compare[T constraints.Ordered] struct{}

Compare exists as a temporary measure to provide a simple cmp() implementation for any ordered types. This was implemented to enable us to handle the exp/slices update to SortFunc() which switched from expecting a less() function to a cmp() function.

Once we upgrade to Go 1.21 we can remove this and use the builtin cmp package - see https://pkg.go.dev/cmp

func (Compare[T]) Cmp added in v1.2.2

func (c Compare[T]) Cmp(a, b T) int

Cmp returns -1 if a < b, 0 if a == b, and 1 if a > b.

func (Compare[T]) CmpRev added in v1.2.2

func (c Compare[T]) CmpRev(a, b T) int

CmpRev returns -1 if a > b, 0 if a == b, and 1 if a < b. This is the reverse of Cmp

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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