util

package
v0.11.16 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MaxBitSetSize = 16

Variables

This section is empty.

Functions

func RemoveFileIfExists added in v0.11.13

func RemoveFileIfExists(path string) error

RemoveFileIfExists removes the file, it will return nil if the file does not exist.

Types

type BitSet

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

BitSet Simplified and compact bitset.

func (*BitSet) Count

func (bs *BitSet) Count() int

func (*BitSet) Set

func (bs *BitSet) Set(idx int)

type Sender

type Sender[U any] interface {
	Send(message *U) error
}

type Stream

type Stream[T any] interface {
	Recv() (*T, error)
}

type StreamReader

type StreamReader interface {
	Run() error
}

func ProcessStream

func ProcessStream[T any, U any](
	ctx context.Context,
	stream Stream[T],
	sender Sender[U],
	handleMessage func(*T) (*U, error),
	labels map[string]string,
	log *slog.Logger) StreamReader

func ReadStream

func ReadStream[T any](
	ctx context.Context,
	stream Stream[T],
	handleMessage func(*T) error,
	labels map[string]string,
	log *slog.Logger) StreamReader

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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