Instance Method
append(onPrevious:generator:)
Adds another
EventLoopFuture producing closure to be run as soon as all previously queued future have completed, succeeded, or failed.func append<Value>(onPrevious next: EventLoopFutureQueue.ContinueCondition = .complete, generator: @escaping () -> EventLoopFuture<Value>) -> EventLoopFuture<Value>
Parameters
nextThe condition that the previous future(s) must meet on thier completion for the appended future to be run. The default value is
.complete.generatorThe closure that produces the
EventLoopFuture. We need a closure because otherwise the future starts running right away and the queuing doesn’t do you any good.
Return Value
The resulting future from the generator closure passed in.
Discussion
let model: EventLoopFuture<Model> = queue.append(generator: { Model.query(on: database).first() })