Documentation
¶
Index ¶
- type Pipe
- func (t *Pipe) GetReadData() map[time.Duration][]byte
- func (t *Pipe) GetWriteData() map[time.Duration][]byte
- func (t *Pipe) Read(p []byte) (n int, err error)
- func (t *Pipe) SetInput(r io.Reader) *Pipe
- func (t *Pipe) SetOutput(w io.Writer) *Pipe
- func (t *Pipe) SetStartTime(time time.Time) *Pipe
- func (t *Pipe) Write(p []byte) (n int, err error)
- type PipeOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pipe ¶
type Pipe struct {
// contains filtered or unexported fields
}
func New ¶
func New(options ...PipeOption) *Pipe
New creates a new instance of Pipe with the provided options.
The options parameter is variadic and allows for configuration of the Pipe. It accepts zero or more PipeOption values.
The function returns a pointer to the created Pipe.
func (*Pipe) GetReadData ¶
GetReadData returns the map of bytes read from the pipe, indexed by time duration.
It does not take any parameters. It returns a map of time duration to a slice of bytes.
func (*Pipe) GetWriteData ¶
GetWriteData returns the data to be written by the Pipe.
It returns a map with time durations as keys and byte slices as values.
func (*Pipe) Read ¶
Read reads data from the input into the given byte slice. Storing the time passed since the start time of the pipe
It returns the number of bytes read and any error encountered.
func (*Pipe) SetInput ¶
SetInput assigns an input reader to the Pipe.
r - the input reader to be assigned. Returns the modified Pipe.
func (*Pipe) SetOutput ¶
SetOutput sets the output for the Pipe.
It takes a parameter `w` of type `io.Writer` and returns a pointer to `Pipe`.
func (*Pipe) SetStartTime ¶
SetStartTime sets the start time of the Pipe.
time - the time to set as the start time. Returns a pointer to the Pipe.
type PipeOption ¶
type PipeOption func(*Pipe)
func SetStartTime ¶
func SetStartTime(time time.Time) PipeOption
SetStartTime sets the start time of the Pipe.
time: the start time to set. Returns: a PipeOption function.
func StartNow ¶
func StartNow() PipeOption
StartNow returns a PipeOption function that sets the start time of the Pipe to the current time.
It takes no parameters and returns a PipeOption.
func WithInput ¶
func WithInput(r io.Reader) PipeOption
WithInput returns a PipeOption function that sets the input of a Pipe.
r is the input reader. PipeOption is a function that modifies a Pipe.
func WithOutput ¶
func WithOutput(w io.Writer) PipeOption
WithOutput sets the output writer for the Pipe.
w: the output writer to set. Returns: a PipeOption function.