--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/545d0597-66a0-4412-8ca7-3d447f88ccafn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/d9e4e00f-2251-453c-88f2-5e2bb8e61c8bn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/f909420c-6662-4ae3-866a-77b2faba9c76n%40googlegroups.com.
io.Pipe
. The io.Pipe
function returns a connected pair of *PipeReader
and *PipeWriter
, where writes to the *PipeWriter
are directly read from the *PipeReader
. The Write
call on the *PipeWriter
will block until the data is read from the *PipeReader
.--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/C5B2823D-2458-4F91-A09D-6B12F74CD8B3%40jimsmart.org.
you can achieve this using anio.Pipe
. Theio.Pipe
function returns a connected pair of*PipeReader
and*PipeWriter
, where writes to the*PipeWriter
are directly read from the*PipeReader
. TheWrite
call on the*PipeWriter
will block until the data is read from the*PipeReader
.pr, pw := io.Pipe()Pass the pr as the body and write to the pw.
--On Wed, Mar 22, 2023, 7:06 PM 'Jim Smart' via golang-nuts <golan...@googlegroups.com> wrote:The issue here, isn’t that I am uploading a big file — that’s easy.
As I said in my initial post:
> The use case here is that I'm wishing to send very large UPDATE/INSERT queries/commands to an HTTP endpoint, and the body content of those queries/commands is actually generated from a database.
The content I wish to push to the server, is /generated/ content. So really what I want is a something I can directly write into.
I am trying to avoid generating my upload content into a buffer first. Because the data can be very large.
— It’s easy to say “write a reader” but writing it as a reader involves doing complete inversion of control on my code, and isn’t really feasible. I can’t easily make the code I have which has complex logic to build the upload data using Writes, into something that is then driven by Reads.
Which is why I asked if it was possible to somehow Write straight down the connection.
— Thanks for the suggestions all the same.
/J
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/C5B2823D-2458-4F91-A09D-6B12F74CD8B3%40jimsmart.org.
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CA%2Bh8R2pTUXsWPpywxhRJi_Bs3ZP0hmVP%3DkqZMe6FwJWJS-3BDg%40mail.gmail.com.
Is this possible at all with the stdlib http.Client? Perhaps with an io.Pipe as the request body?