Table<Columns>
Extended by
Type Parameters
Type Parameter | Default type |
---|---|
Columns extends ColumnsType | ColumnsType |
Constructors
new Table()
new Table<Columns>(columns, options?): Table<Columns>
Creates a new Table instance.
This constructor supports two different versions:
- New constructor: Using a Columns object and an optional TableV2Options object
- Deprecated constructor: Using a TableOptions object (will be removed in the next major release)
Parameters
Parameter | Type |
---|---|
columns | Columns |
options ? | TableV2Options |
Returns
Table
<Columns
>
Examples
// New Constructor
const table = new Table(
{
name: column.text,
age: column.integer
},
{ indexes: { nameIndex: ['name'] } }
);
// Deprecated Constructor
const table = new Table({
name: 'users',
columns: [
new Column({ name: 'name', type: ColumnType.TEXT }),
new Column({ name: 'age', type: ColumnType.INTEGER })
]
});
new Table()
new Table<Columns>(options): Table<Columns>
Parameters
Parameter | Type |
---|---|
options | TableOptions |
Returns
Table
<Columns
>
Deprecated
This constructor will be removed in the next major release. Use the new constructor shown below instead as this does not show types.
Example
Use this instead ```javascript const table = new Table( { name: column.text, age: column.integer }, { indexes: { nameIndex: ['name'] } } ); ```Accessors
columnMap
Get Signature
get columnMap(): Columns