chankit

package
v0.247.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Merge

func Merge[T any, Chan chan T | <-chan T](chans ...Chan) (_ <-chan T, cancel func())

Merge will join channels into a single one channel. If any of the channels receive a value, it will surface from out.

Example
package main

import (
	"go.llib.dev/frameless/pkg/chankit"
)

func main() {
	var (
		ch1 = make(chan int)
		ch2 = make(chan int)
		ch3 = make(chan int)
	)

	out, cancel := chankit.Merge(ch1, ch2, ch3)
	defer cancel()

	// out will receive values from ch1, ch2, ch3
	<-out
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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