furious-luke / polecat

A lean, powerful, and enjoyable web framework.
MIT License
3 stars 0 forks source link

Query branch reduction #62

Open furious-luke opened 5 years ago

furious-luke commented 5 years ago

When performing multiple branched inserts, usually as a result of a custom mutation inserting an array of models, selections from each insert are often required. To support this a union of results from each branched insert is needed.

A new query operation, reduce, could be used to perform the union across all branches. Initially it would just concatenate results, but it could potentially be used to perform a function on each result. It would probably look something like:

query = (
    Q(Model)
    .insert(...).select(...)
    .insert(...).select(...)
    .reduce()
)