2 ms·
Looks like the channel field is private in CDCRecordStream, but exposed by GetRecords. The callers mostly loop over Record objects. [1] If I wanted to encapsul
by skybrian 3y ago
Looks like the channel field is private in CDCRecordStream, but exposed by GetRecords. The callers mostly loop over Record objects. [1]
If I wanted to encapsulate iterating over a channel of Records, maybe it would be something like Go's io.Pipe function [2], which returns a PipeReader and PipeWriter? Except that it would work on Records rather than byte streams.
I don't have enough context to know if the extra encapsulation is a good idea in this case, though.
[1] https://github.com/search?q=repo%3APeerDB-io%2Fpeerdb%20GetRecords&type=code https://github.com/search?q=repo%3APeerDB-io%2Fpeerdb%20GetR...
[2] https://pkg.go.dev/io#Pipe https://pkg.go.dev/io#Pipe