Documentation ¶
Overview ¶
Package channel provides helper structs/methods/funcs for working with channels
Proxy from an io.Writer to a channel:
w := channel.NewWriter(make(chan []byte, 10)) go func() { w.Write([]byte("Hello, World")) }() fmt.Println(string(<-w.Chan())) w.Close()
Use of the constructor is required to initialize the channel. Provide a channel of sufficient size to handle messages from writer(s).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WriteCloser ¶
type WriteCloser interface { io.WriteCloser Chan() <-chan []byte }
WriteCloser is an io.WriteCloser that that proxies Write() calls to a channel The []byte buffer of the Write() is queued on the channel as one message.
func NewWriter ¶
func NewWriter(c chan []byte) WriteCloser
NewWriter initializes a new channel writer
Click to show internal directories.
Click to hide internal directories.