lookup¶
Finds a persisted entity from storage (e.g. RDBMS, Document Store, Big Data, cache) based on a key search.
Given entity
types are stored based on a key, a lookup
function fetches the entity
with a matching key. This operation is expected to be fast given its a primary-key based fetch with
the option of being cached.
Parameters:
No. | Type | Comments |
---|---|---|
1 | entity | The entity type being queried |
2 | key | The key to search for an entity |
Returns:
An optional entity type specified as the 1st argument.
If no match found, a none
value returned.
Usages:
lookup( <entity type>, <key instance> ) : <entity instance> ?
- Object returned is optional
Example:
let optOrder = lookup( Order, new OrderKey(orderId) )
Lookup an Order given an id string.