Tables and Views
Entity Base
All the base TypeScript classes in an ORM file that represent a table or view (entity) extend the base class EntityBase
. This base class is located in the wire-orm-base.ts
file.
All the fields in an entity are defined on the ORM entity class which allows query results to be referenced using strong types. See DataTable Interface for details.
Fields
All the fields in an entity are created by name in an enum
structure. The naming convention for the fields enum
is [entity]Field.
Constructor
The constructor for an entity class take three parameters.
Parameter | Description |
source | The |
entity | The name of the entity in the SQL database |
keys? | An optional array of primary key fields if they exist and the entity is a table. These are used in write operations. |
DataTable Interface
The results of base queries are returned as wire.data.DataTable objects. In order for the Rows
property on a data table to contains typed objects for a ORM class, an interface is used to override the property on the data table for each class. The execAsync
method calls into its modified base method returning an instance of the typed object.
Last updated