package
1.3.48
Repository: https://github.com/sandwich-go/boost.git
Documentation: pkg.go.dev

# README

xchan

https://colobu.com/2021/05/11/unbounded-channel-in-go/

Unbounded chan with ring buffer.

Refer to the below articles and issues:

  1. https://github.com/golang/go/issues/20352
  2. https://stackoverflow.com/questions/41906146/why-go-channels-limit-the-buffer-size
  3. https://medium.com/capital-one-tech/building-an-unbounded-channel-in-go-789e175cd2cd
  4. https://erikwinter.nl/articles/2020/channel-with-infinite-buffer-in-golang/

Usage

ch := NewUnboundedChan(1000)
// or ch := NewUnboundedChanSize(10,200,1000)

go func() {
    for ...... {
        ...
        ch.In <- ... // send values
        ...
    }

    close(ch.In) // close In channel
}()


for v := range ch.Out { // read values
    fmt.Println(v)
}

# Functions

InstallOptionsWatchDog the installed func will called when NewOptions called.
NewOptions new Options.
No description provided by the author
NewUnboundedChan creates the unbounded chan.
NewUnboundedChanSize is like NewUnboundedChan but you can set initial capacity for In, Out, Buffer.
go:generate optionGen --option_return_previous=false.
WithCallback option func for filed Callback.
WithCallbackOnBufCount option func for filed CallbackOnBufCount.

# Variables

No description provided by the author

# Structs

Options should use NewOptions to initialize it.
RingBuffer is a ring buffer for common types.
UnboundedChan is an unbounded chan.

# Interfaces

OptionsInterface visitor + ApplyOption interface for Options.
OptionsVisitor visitor interface for Options.

# Type aliases

Option option func.