Model class represents an application entity that is modeled according to your OneTable schema. With one-table design patterns, multiple entities items are stored in a single DynamoDB table and are distinguished by unique primary keys and a
type attribute that designates the model type. The schema specifies the entity attributes and keys and the Model instance is the mechanism by which you interact with specific entities in your table.
Models are defined via the Table
schema definition and model instances are created using the Table.getModel(name) method.
table is a configured instance of
Table. Name is the name of the model.
In TypeScript, use the following pattern to return a fully typed model:
Thereafter, the references to User instances will be fully type checked. Note: you must add "as const" to the end of your models after the closing brace.
The model constructor is an internal method and you should not normally construct model instances directly.
The Model constructor
|Field attribute definitions. Same format as in the Table
|Index definition. Same format as in the Table
|Make "created" and "updated" timestamps in items