Files
learngo/logparser/v5/pipe/pipe.go

28 lines
783 B
Go
Raw Permalink Normal View History

2019-08-28 23:46:42 +03:00
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
2019-10-30 19:34:44 +03:00
// For more tutorials : https://learngoprogramming.com
// In-person training : https://www.linkedin.com/in/inancgumus/
// Follow me on twitter: https://twitter.com/inancgumus
2019-08-28 23:46:42 +03:00
package pipe
// Iterator yields a record.
type Iterator interface {
2019-08-29 16:08:46 +03:00
Each(func(Record) error) error
2019-08-28 23:46:42 +03:00
}
// Consumer consumes records from an iterator.
type Consumer interface {
Consume(Iterator) error
}
// Transform represents both a record consumer and producer.
// It has an input and output.
// It takes a single record and provides an iterator for all the records.
type Transform interface {
Iterator // producer: should never return on yield().err == nil
Consumer
}