Genesis supports a number of different read operations. Although the specifics vary between the different interfaces, the underlying principles remain the same. This page explains these principles, without going into specific calls.
When reading records, you can optionally specify a list of fields to be returned. This is useful when reading tables with a large number of columns.
There are three operations that request individual records from the database:
To request a single record from the database, a unique index must be specified. If a matching record is found, then it is returned. Otherwise, the operation will return no results.
getAll bundles multiple
get operations into a single request. Each request must have a unique index identifier and a unique reference for the request.
The result will be a map, where the unique reference is the key, and the value is the record, or
null if not found.
getAllAsList operation is similar to
getAll. However, this only requires one unique index identifier. The results are returned as a list, in the same order they are requested. When a record is not found, a null value will be in its place in the list.
There are two operations that request a whole table from the database:
When the whole table is returned, the records will be returned in sorted order (if the database supports it). By default, the records are ordered by the primary key, unless you provide another index.
The database can return ranges that can be described as:
- a range described by a non-unique index identifier
- a range between two index identifiers
For each of these, Genesis supports the following operations
getBulk, the records will be sorted, if the database supports it.