Coder Social home page Coder Social logo

Comments (5)

bitemyapp avatar bitemyapp commented on June 30, 2024

So, there's a BulkOperation data type. That contains all the information required to generate a request.

From there, to get a ByteString you can use collapseStream to turn a list of BulkOperations into a ByteString.

https://github.com/bitemyapp/bloodhound/blob/master/Database/Bloodhound/Client.hs#L175-L179

All that happens after that is bulk POSTs the generated: https://github.com/bitemyapp/bloodhound/blob/master/Database/Bloodhound/Client.hs#L173

Do you want collapseStream to be exported? If so, I'd probably rename it to something more explicitly about bulk operations first.

from bloodhound.

chrismwendt avatar chrismwendt commented on June 30, 2024

collapseStream is pretty close to what I'm looking for, because I would just need to construct my own data structure (maybe Network.HTTP.Base.Request?) before sending it out. Even better would be a function which returns the data structure itself, so that the building of HTTP requests can be done separately from the sending. This isn't a critical feature, but I think it fits nicely into the concept of separating pure and impure code.

from bloodhound.

bitemyapp avatar bitemyapp commented on June 30, 2024

This isn't a critical feature, but I think it fits nicely into the concept of separating pure and impure code.

Yeah, that's fine.

Network.HTTP.Base.Request

That's specific to a library I'm not using. I'm not adding that as a dependency.

https://hackage.haskell.org/package/http-types-0.8.5/docs/Network-HTTP-Types.html

There are neutral component types for things like methods, but not the requests themselves for various reasons.

I'll expose collapseStream with a more specific name so you can turn the bulk operations into the bytestring blob that can be posted, there's really not much more information than that - method POST and the server you're POST'ing to.

from bloodhound.

bitemyapp avatar bitemyapp commented on June 30, 2024

Fixed by b911e9a

They're exported from the library as encodeBulkOperations and encodeBulkOperation. I added documentation as well.

I can't guarantee I'll push 0.4.0.0 to Hackage soon, but you can at least clone it and install for your builds immediately.

from bloodhound.

chrismwendt avatar chrismwendt commented on June 30, 2024

Awesome, thanks!

from bloodhound.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.