Constructor
new Table(table)
Initialize the table using a schema object.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
table |
Object | An object containing a table definition.
Properties
|
- Source:
Members
columns :Array.<Column>
The array of columns.
Type:
- Array.<Column>
- Source:
foreignKeys :Array.<ForeignKey>
An array of ForeignKey instances describing the relationship between
this table and others.
Type:
- Array.<ForeignKey>
- Source:
mapTo :string
The property name in the resulting normalized object.
Type:
- string
- Default Value:
- table.name
- Source:
name :string
The name of the column.
Type:
- string
- Source:
primaryKey :Array.<Column>
The table's primary key.
Type:
- Array.<Column>
- Source:
Methods
addColumn(column) → {this}
Add a column.
Parameters:
Name | Type | Description |
---|---|---|
column |
Column | object | The Column, or a suitable schema object for the Column constructor. |
- Source:
Returns:
- Type
- this
getColumnByMapping(mapping) → {Column}
Get a column by mapping (it's mapTo property).
Parameters:
Name | Type | Description |
---|---|---|
mapping |
string | The column's mapTo property. |
- Source:
Returns:
The column instance.
- Type
- Column
getColumnByName(name) → {Column}
Get a column by name.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The column name. |
- Source:
Returns:
The Column instance.
- Type
- Column
isColumnMapping(mapping) → {boolean}
Check if mapping matches a column.
Parameters:
Name | Type | Description |
---|---|---|
mapping |
string | The column's mapTo property. |
- Source:
Returns:
- Type
- boolean
isColumnName(name) → {boolean}
Check if name matches a column.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The column name. |
- Source:
Returns:
- Type
- boolean