eventsourcing/es4j

Problem: Min/Max queries are global to the attribute

Open

#209 aperta il 27 gen 2017

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)Java (27 fork)batch import
enhancementhelp wanted

Metriche repository

Star
 (406 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

At this moment, Min/Max queries are limited to finding the smallest or largest value of a particular attribute globally across an entity. Which means you can tell "what's the latest order" but not "what's the latest order for this person". IsLatestEntity/LatestAssociatedEntryQuery are currently being used to address this type of need, but they are very slow and cumbersome. Min/Max has been already optimized for PostgreSQL storage.

It would have been great if it was possible to fit this type query within Min/Max as an option:

// Find the last order for user with id=<id>
max(Order.TIMESTAMP, equal(Order.USER_ID, id))
// Find all last orders for all users
max(Order.TIMESTAMP, Order.USER_ID)

(Or something similar)

Guida contributor