Files
learngo/logparser/v6/pipe/pipe.go

27 lines
619 B
Go
Raw Normal View History

2019-08-28 18:54:57 +03:00
// For more tutorials: https://blog.learngoprogramming.com
//
// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
package pipe
// Iterator yields a record.
type Iterator interface {
Each(func(Record)) error
}
2019-08-28 22:18:37 +03:00
// Consumer consumes records from an iterator.
type Consumer interface {
Consume(Iterator) error
2019-08-28 18:54:57 +03:00
}
// 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 {
2019-08-28 22:18:37 +03:00
Consumer
2019-08-28 18:54:57 +03:00
Iterator // producer
}