ElasticSwift
ElasticSwift copied to clipboard
Have you considered using Futures instead of callbacks?
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.
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).