ConfigMap
that defines the configuration's EntityMap
, key properties, and TranscodeMap
. If omitted, defaults to BaseConfigMap
.
Create an EntityManager instance.
Get the current EntityManager Config
object.
Current Config
object.
Set the current EntityManager Config
object.
Config
object.
Update generated properties, hash key, and range key on an EntityItem
object.
Config
entities
key.
EntityItem
object.
Optional
overwrite: booleanOverwrite existing properties (default false
).
EntityRecord
object with updated properties.
Update generated properties, hash key, and range key on an array of EntityItem
objects.
Config
entities
key.
Optional
overwrite: booleanOverwrite existing properties (default false
).
An array of EntityRecord
objects with updated properties.
Encode a generated property value. Returns a string or undefined if atomicity requirement of sharded properties not met.
Config generatedProperties
key.
EntityItem
object.
Encoded generated property value.
Error
if property
is not a Config generatedProperties
key.
Find an index token in a Config
object based on the index hashKey
and rangeKey
.
Index hash key.
Index range key.
Optional
suppressError: booleanSuppress error if no match found.
Index token if found.
Convert an EntityItem
into an EntityKey
.
Config
entities
key.
EntityItem
object.
Optional
overwrite: booleanOverwrite existing properties (default false
).
EntityKey
extracted from shallow clone of item
with updated properties.
Convert an array of EntityItem
objects into EntityKey
objects.
Config
entities
key.
Array of EntityItem
objects.
Optional
overwrite: booleanOverwrite existing properties (default false
).
An array of EntityKey
objects extracted from shallow clone of each item
with updated properties.
Protected
queryProtected
Query a database entity across shards in a provider-generic fashion.
QueryOptions
object.
QueryResult object.
The provided shardQueryMap
performs the actual query of individual data pages on individual index/shard combinations.
Individual shard query results will be combined, deduped by Config
uniqueProperty
value, and sorted by sortOrder
.
In queries on sharded data, expect the leading and trailing edges of returned data pages to interleave somewhat with preceding & following pages.
Unsharded query results should sort & page as expected.
Normally this method should not be called directly! It is used by a platform-specific QueryBuilder.query
method to provide a fluent query API.
Error if options
pageKeyMap
pageKeyMap
keys do not match shardQueryMap
keys.
Strips generated properties, hash key, and range key from an EntityRecord
object.
Config
entities
key.
EntityRecord
object.
EntityItem
with generated properties, hash key & range key removed.
Strips generated properties, hash key, and range key from an array of EntityRecord
objects.
Config
entities
key.
Array of EntityRecord
objects.
Array of EntityItem
objects with generated properties, hash key & range key removed.
The EntityManager class applies a configuration-driven sharded data model & query strategy to NoSql data.
Remarks
While the
query
method ispublic
, normally it should not be called directly. Thequery
method is used by a platform-specificQueryBuilder.query
method to provide a fluent query API.