internal

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Drain

func Drain[T any](vals <-chan T, errs <-chan error) ([]T, error)

Drain[T any](vals <-chan T, errs <-chan error) ([]T, error) function reads from the channel vals until it is closed and stores the read values into a slice of type T. If errs channel is closed, the function returns the stored values and nil error. If an error is received from errs channel, the function returns the stored values and that error.

func NopLogger

func NopLogger() *slog.Logger

NopLogger [func] returns a new logger that discards all log messages. It implements the slog.Handler interface and is intended to be used in tests or when logging is not desired.

func Walk

func Walk[T any](vals <-chan T, errs <-chan error, fn func(T) error) error

Walk iterates over values received from a channel [vals] and applies a function [fn] to each value. If the function returns an error, Walk returns that error. If values are received on the error channel [errs], Walk stops iterating and returns the first error encountered.

Types

This section is empty.

Directories

Path Synopsis
git

Jump to

Keyboard shortcuts

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