stream: clone stream before execution

This commit is contained in:
Asdine El Hrychy
2024-02-17 17:56:41 +04:00
parent bac26ce46a
commit 71146bcc9b
37 changed files with 464 additions and 13 deletions

View File

@@ -17,6 +17,18 @@ func Concat(s ...*Stream) *ConcatOperator {
return &ConcatOperator{Streams: s}
}
func (it *ConcatOperator) Clone() Operator {
streams := make([]*Stream, len(it.Streams))
for i, s := range it.Streams {
streams[i] = s.Clone()
}
return &ConcatOperator{
BaseOperator: it.BaseOperator.Clone(),
Streams: streams,
}
}
func (it *ConcatOperator) Iterate(in *environment.Environment, fn func(*environment.Environment) error) error {
for _, s := range it.Streams {
if err := s.Iterate(in, fn); err != nil {