ElasticSwift icon indicating copy to clipboard operation
ElasticSwift copied to clipboard

Have you considered using Futures instead of callbacks?

Open cshadek opened this issue 4 years ago • 1 comments

This would be similar to how Fluent works in Vapor and avoid callbacks.

I could see something along these lines:

return client.query().set(indices: ...).set(types: ...).search().map {
       // Code
}

Where .search() returns an EventLoopFuture<SearchResponse<T: Codable>>

It would make the code much more concise (Swifty 😉) and would fit better with packages like Vapor and Soto.

cshadek avatar Dec 08 '20 19:12 cshadek

Having a functional API is something I have been wanting to add for so long but unfortunately, the Swift echo system doesn't have a standard functional API. I do have plans to add functional API based on Combine/OpenCombine in the future (probably after 1.0).

prafsoni avatar Dec 11 '20 06:12 prafsoni