utils

package
v0.0.0-...-21311fb Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Collect

func Collect(ctx context.Context, cancel func(), errChan chan error, valuesChan chan interface{}) ([]interface{}, error)

Collect collects errors and values from channel provided, honouring timeout it will expect exactly cap(errChan) messages value channel could be nil. If not nil, then cap(errCh) == cap(valueCh) it will also cancel context on first error occured if cancel func is not nil

func CollectErrors

func CollectErrors(ctx context.Context, errChan chan error) error

CollectErrors exhausts error channel errChan up to its capacity and returns aggregate error if any

func IsContextCancelledError

func IsContextCancelledError(err error) bool

IsContextCancelledError returns true if the given error is a context cancelled error

Types

type SafeByteBuffer

type SafeByteBuffer struct {
	// contains filtered or unexported fields
}

SafeByteBuffer is a goroutine safe bytes.Buffer

func (*SafeByteBuffer) String

func (s *SafeByteBuffer) String() string

String returns the contents of the unread portion of the buffer as a string. If the Buffer is a nil pointer, it returns "<nil>".

func (*SafeByteBuffer) Write

func (s *SafeByteBuffer) Write(p []byte) (n int, err error)

Write appends the contents of p to the buffer, growing the buffer as needed. It returns the number of bytes written.

Jump to

Keyboard shortcuts

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