chankit

package
v0.318.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Batch added in v0.314.0

func Batch[T any](ch chan T, opts ...BatchOption) chan []T

func Collect added in v0.314.0

func Collect[T any](src <-chan T) []T

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

type BatchConfig added in v0.314.0

type BatchConfig struct {
	Size      int
	WaitLimit time.Duration
}

func (BatchConfig) Configure added in v0.314.0

func (c BatchConfig) Configure(t *BatchConfig)

type BatchOption added in v0.314.0

type BatchOption option.Option[BatchConfig]

Jump to

Keyboard shortcuts

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