-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use proper Reader and Writer semantics #21
Comments
Good question. We wanted to provide a common interface for all codecs, and since (at the time of initial writing) the JSON encoder used simple marshal/unmarshal methods (i.e. no Encoders which I believe were added later) we went with that. If you'd like to contribute to designing codecs2, we'd love your input. On 3 Sep 2013, at 22:11, Tamás Gulácsi [email protected] wrote:
|
Thanks for the positive response! My use case is a niche, but I have to send unlimited data (records from database query resultset) to the client. The generalization is a little bit harder: how should we represent such an iterator-like interface? type Iterable interface { and specialize the marshaler for it - but first a real-world use case would be needed. The usage of io.Reader / io.Writer is easier, though. |
Even without the io.Reader and io.Writer interface, you could use codecs, and just write each response out like you do with your hand-made encoder. At least that way, you could still get the benefit of multiple formats. An interesting problem. On 3 Sep 2013, at 23:36, Tamás Gulácsi [email protected] wrote:
|
I think it should go to designing codecs2 - streaming is definitely a better interface. On Feb 5, 2014, at 11:31 AM, Tyler [email protected] wrote:
|
Why do you encode/marshal into a freshly allocated []byte, and do you require a []byte for unmarshal? Even proper encodings/csv is hidden behind this memory-hungry, nonscalable interface...
The text was updated successfully, but these errors were encountered: