channel

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PushNoBlock added in v0.13.1

func PushNoBlock[T any](ch chan T, t T) bool

func ReadAll

func ReadAll[T any](ctx context.Context, ch chan *entity.TWithError[T]) ([]T, error)

Types

type OverrideChannel added in v0.13.1

type OverrideChannel[T any] interface {
	io.Closer

	Receive(ctx context.Context) (T, error)

	//
	Ch() chan T

	// Update the latest value
	WriteLast(value T)
}

OverrideChannel is a type of channel that only keeps the latest value, the write operation never blocks.

func NewOverrideChannel added in v0.13.1

func NewOverrideChannel[T any]() OverrideChannel[T]

Jump to

Keyboard shortcuts

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