Documentation ¶
Index ¶
- Variables
- func Copy(r io.Reader, w io.Writer, c CopyConfig) (e error)
- func RW2Chan(r io.ReadCloser, w io.WriteCloser) (rc, wc chan []byte)
- func WithCtxCopy(ctx context.Context, callTree string, copybuf []byte, to time.Duration, ...) error
- func WithCtxTO(ctx context.Context, callTree string, to time.Duration, w io.Writer, ...) io.ReadWriteCloser
- type CopyConfig
- type IOpipe
- type RWC
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrWrite = errors.New("ErrWrite") ErrRead = errors.New("ErrRead") )
Functions ¶
func RW2Chan ¶
func RW2Chan(r io.ReadCloser, w io.WriteCloser) (rc, wc chan []byte)
no close rc any time you can close wc, r, w.
func WithCtxCopy ¶ added in v0.28.1
func WithCtxCopy(ctx context.Context, callTree string, copybuf []byte, to time.Duration, w io.Writer, r io.Reader, panicf ...func(s string)) error
close reader by yourself
to avoid writer block after ctx done, you should close writer after ctx done
call Close() after writer fin
func WithCtxTO ¶ added in v0.28.1
func WithCtxTO(ctx context.Context, callTree string, to time.Duration, w io.Writer, r io.Reader, panicf ...func(s string)) io.ReadWriteCloser
close reader by yourself
to avoid writer block after ctx done, you should close writer after ctx done
call Close() after writer fin
Types ¶
type CopyConfig ¶ added in v0.28.1
type CopyConfig struct {
BytePerLoop, MaxLoop, MaxByte, BytePerSec uint64
}
type IOpipe ¶ added in v0.28.1
type IOpipe struct { R *io.PipeReader W *io.PipeWriter // contains filtered or unexported fields }
func (*IOpipe) CloseWithError ¶ added in v0.28.1
Click to show internal directories.
Click to hide internal directories.