Skip to Content
Hands-On Software Engineering with Golang
book

Hands-On Software Engineering with Golang

by Achilleas Anagnostopoulos
January 2020
Intermediate to advanced
640 pages
16h 56m
English
Packt Publishing
Content preview from Hands-On Software Engineering with Golang

Implementing the input source worker

In order to begin a new pipeline run, users are expected to provide an input source that generates the application-specific payloads that drive the pipeline. All user-defined input sources must implement the Source interface, whose definition is as follows:

type Source interface {
    Next(context.Context) bool
    Payload() Payload
    Error() error
}

The Source interface contains the standard set of methods that you would expect for any data source that supports iteration:

  • Next attempts to advance the iterator. It returns false if either no more data is available or an error occurred.
  • Payload returns the a new Payload instance after a successful call to the iterator's Next method.
  • Error returns the last error ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Software Architecture with Golang

Hands-On Software Architecture with Golang

Jyotiswarup Raiturkar

Publisher Resources

ISBN: 9781838554491Supplemental Content