Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCancelReadCloser ¶
func NewCancelReadCloser(ctx context.Context, in io.ReadCloser) io.ReadCloser
NewCancelReadCloser creates a wrapper that closes the ReadCloser when the context is cancelled. The returned io.ReadCloser must be closed when it is no longer needed.
func NewReadCloserWrapper ¶
func NewReadCloserWrapper(r io.Reader, closer func() error) io.ReadCloser
NewReadCloserWrapper returns a new io.ReadCloser.
Types ¶
type OnEOFReader ¶
type OnEOFReader struct { Rc io.ReadCloser Fn func() }
OnEOFReader wraps an io.ReadCloser and a function the function will run at the end of file or close the file.
func (*OnEOFReader) Close ¶
func (r *OnEOFReader) Close() error
Close closes the file and run the function.
type ReadCloserWrapper ¶
ReadCloserWrapper wraps an io.Reader, and implements an io.ReadCloser It calls the given callback function when closed. It should be constructed with NewReadCloserWrapper
func (*ReadCloserWrapper) Close ¶
func (r *ReadCloserWrapper) Close() error
Close calls back the passed closer function
Click to show internal directories.
Click to hide internal directories.