Grokking Advanced Go
Vote

0% completed

​

Composing io Readers and Writers

Suppose a customer asks for an export of 10 million orders. Must the program hold all that text in memory before it sends the first byte? And if the export must also be counted and compressed before it is sent, does the export function need code for those steps?

The answer to both questions is no, and the reason is the size of two interfaces. Small Interfaces and Composition showed that one export function can write to any io.Writer. A wrapper around a writer is itself a writer

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content