Documentation
¶
Index ¶
- func NewDynamicReader[T any](args NewDynamicReaderArgs[T]) core.Reader[T]
- func NewDynamicWriter[T any](args NewDynamicWriterArgs[T]) core.Writer[T]
- func NewStaticReader[T any](args NewStaticReaderArgs[T]) core.Reader[T]
- func NewStaticWriter[T any](args NewStaticWriterArgs[T]) core.Writer[T]
- type NewDynamicReaderArgs
- type NewDynamicWriterArgs
- type NewStaticReaderArgs
- type NewStaticWriterArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDynamicReader ¶
func NewDynamicReader[T any](args NewDynamicReaderArgs[T]) core.Reader[T]
NewDynamicReader returns a reader which wraps args.Reader with sleep/delay, the minimum duration being set with args.Delay.
Unlike NewStaticReader, this one has a couple extra properties. Firstly it tries to adjust the sleep duration to a constant args.Delay, it does so by subtracting args.Delay by the time it took to read from args.Reader. Secondly, you may set ctx value "bounds" if you know how many times args.Reader may be called before io.EOF, in that case the whole stream will be read in approximately args.Delay. This is useful if you want a complete ETL pipeline to take a specific amount of time.
Examples (interactive):
func NewDynamicWriter ¶
func NewDynamicWriter[T any](args NewDynamicWriterArgs[T]) core.Writer[T]
NewDynamicWriter returns a Writer which writes to args.Writer and then sleeps for the duration defined with args.Delay, or until ctx is done.
Unlike NewStaticWriter, this one has a couple extra properties. Firstly it tries to adjust the sleep duration to a constant args.Delay, it does so by subtracting args.Delay by the time it took to write to args.Writer. Secondly, you may set ctx value "bounds" if you know how many things there are to write and you want to write _all_ items in args.Delay amount of time. This is useful if you want a complete ETL pipeline to take a specific amount of time.
Examples (interactive):
func NewStaticReader ¶
func NewStaticReader[T any](args NewStaticReaderArgs[T]) core.Reader[T]
NewStaticReader returns a reader which wraps args.Reader with sleep/delay, the duration being set with args.Delay. When reading from the returned reader, the operation happens either after args.Delay has elapsed, or if ctx is done.
Examples (interactive):
func NewStaticWriter ¶
func NewStaticWriter[T any](args NewStaticWriterArgs[T]) core.Writer[T]
NewStaticWriter returns a Writer which writes to args.Writer and then sleeps for the duration defined with args.Delay, or until ctx is done.
Examples (interactive):