Help us shape the future of Go! Take the 2026 Go Developer Survey

chantools

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Broadcast

func Broadcast[T any](src <-chan T, qty uint) []<-chan T

func BroadcastSync

func BroadcastSync[T any](src <-chan T, qty uint) []<-chan T

func CastTo

func CastTo[T any](ch <-chan any) <-chan T

func CastToAny

func CastToAny[T any](ch <-chan T) <-chan any

func CastToReader

func CastToReader[T any](ch []chan T) []<-chan T

func ChanBuffErrGenerator

func ChanBuffErrGenerator[C any](worker func(chan<- C, chan<- error), count int, extensions ...ChanGeneratorExtension[C]) (<-chan C, <-chan error)

func ChanBuffGenerator

func ChanBuffGenerator[C any](worker func(chan<- C), count int, extensions ...ChanGeneratorExtension[C]) <-chan C

func ChanErrGenerator

func ChanErrGenerator[C any](worker func(c chan<- C, err chan<- error), extensions ...ChanGeneratorExtension[C]) (<-chan C, <-chan error)

func ChanGenerator

func ChanGenerator[C any](worker func(chan<- C), extensions ...ChanGeneratorExtension[C]) <-chan C

func FlatChan

func FlatChan[I any](input <-chan []I) <-chan I

func ForEach

func ForEach[T any](inputSlice []T, each func(input T))

func ForEachChan

func ForEachChan[T any](src <-chan T, each func(element T))

func ForwardIf

func ForwardIf[T any](src <-chan T, where func(element T) bool, extensions ...ChanGeneratorExtension[T]) <-chan T

func ForwardTo

func ForwardTo[T any](ctx context.Context, src <-chan T, dst chan<- T, extension ...ForwardToExtensions[T])

func MakeSliceChan

func MakeSliceChan[T any](qty uint) []chan T

func MapChan

func MapChan[I any, O any](input <-chan I, mapper func(input I) (O, error), extensions ...ChanGeneratorExtension[O]) (<-chan O, <-chan error)

func MapSlice

func MapSlice[I any, O any](input []I, mapper func(input I) O) []O

func MergeChan

func MergeChan[E any](inputs ...<-chan E) <-chan E

func MergeMap

func MergeMap[K comparable, V any](elem ...map[K]V) (map[K]V, error)

func Tick

func Tick[I any](ctx context.Context, interval time.Duration, generate func() (I, error)) (<-chan I, <-chan error)

func WithInitialValue

func WithInitialValue[I any](initialValue I) func(c chan<- I)

Types

type BrokerChan

type BrokerChan[E any] struct {
	// contains filtered or unexported fields
}

func NewBrokerChan

func NewBrokerChan[E any](src <-chan E) *BrokerChan[E]

func (*BrokerChan[E]) Subscribe

func (bc *BrokerChan[E]) Subscribe() <-chan E

type ChanGeneratorExtension

type ChanGeneratorExtension[I any] func(c chan<- I)

type ForwardToExtensions

type ForwardToExtensions[I any] func(c I) error

type ListenProperty

type ListenProperty[E any] struct {
	// contains filtered or unexported fields
}

func Listen

func Listen[E any](initialProperty E) *ListenProperty[E]

func ListenChan

func ListenChan[E any](ctx context.Context, initialProperty E, src <-chan E) *ListenProperty[E]

func ListenWithContext

func ListenWithContext[E any](ctx context.Context, initialProperty E) *ListenProperty[E]

func (ListenProperty[E]) Close

func (lp ListenProperty[E]) Close()

func (*ListenProperty[E]) Forward

func (lp *ListenProperty[E]) Forward(ctx context.Context, i <-chan E)

func (*ListenProperty[E]) Set

func (lp *ListenProperty[E]) Set(value E)

func (ListenProperty[E]) Updates

func (lp ListenProperty[E]) Updates() <-chan E

func (ListenProperty[E]) Value

func (lp ListenProperty[E]) Value() E

Jump to

Keyboard shortcuts

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