Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Schema

A Schema is a representation of a serializable database table, consisting of a series of columns and SubSchema objects. It's used when mapping a query to a normalized document. The mapping is defined using TableMetadata, ColumnMetadata, and RelationshipMetadata.

Hierarchy

  • Schema

Index

Constructors

constructor

  • Initialize the Schema instance. Note that the properties are treated as package private: they're accessed directly by DataMapper which provides an efficiency boost, and speed is important here.

    Parameters

    • table: TableMetadata

      Metadata for the Table-decorated Entity. This is used to produce an instance of the Entity.

    • keyColumnMetas: ColumnMetadata[]

      Metadata for the unique column(s) in the table, generally the primary key. The metadata come from Column-decorated properties of a Table-decorated class. Each has the name of the column, the property in the Entity, and an optional Converter.

    • keyColumnNames: string[]

      The name(s) of the column associated with keyColumn in the to-be-serialized query.

    Returns Schema

Properties

columns

columns: SchemaColumn[] = []

All the ColumnMetadata objects (columns of the table) that will be mapped in the resulting document.

schemata

schemata: SubSchema[] = []

All the SubSchema instances of this schema.

table

Metadata for the Table-decorated Entity. This is used to produce an instance of the Entity.

Methods

addColumn

  • Add a column to the schema.

    Parameters

    • meta: ColumnMetadata

      Metadata for the column. The metadata comes from a Column-decorated property of a Table-decorated class and has the name of the column, the property in the Entity, and an optional Converter.

    • name: string

      The name of the column in the to-be-serialized query.

    Returns this

addSchema

getKeyColumns

Generated using TypeDoc