go pipe

2026-08-30 浏览 (1)

pipe.go 源码

// Copyright © 2018 Inanc Gumus
// Learn Go Programming Course
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
//
// For more tutorials  : https://learngoprogramming.com
// In-person training  : https://www.linkedin.com/in/inancgumus/
// Follow me on twitter: https://twitter.com/inancgumus

package pipe

// Iterator yields a record.
type Iterator interface {
	Each(func(Record) error) error
}

// 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
}

你可能感兴趣的文章

go record

go filter

go textreport

go filters

go close

go jsonreport

go jsonlog

go group

go pipeline

go recordshare

  • 所属分类: 后端技术
  • 本文标签: golang
  • 版权声明: 本文链接 https://seaxiang.com/blog/xhAQMrLf