Table<Columns>
A table with a statically-typed Columns record structure.
This is the recommended way to declare tables in PowerSync schemas.
Extends
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.
Parameters
| Parameter | Type | Description |
|---|---|---|
columns | Columns | A Columns object (a record of column names to column types). |
options? | TableOptions | Optional configuration options for the table. |
Returns
Table<Columns>
Example
const table = new Table(
{
name: column.text,
age: column.integer
},
{ indexes: { nameIndex: ['name'] } }
);
Overrides
Properties
| Property | Modifier | Type | Inherited from |
|---|---|---|---|
options | readonly | ResolvedTableOptions | ResolvedTable.options |
Accessors
columns
Get Signature
get columns(): Column[]
Returns
Column[]
Inherited from
ignoreEmptyUpdates
Get Signature
get ignoreEmptyUpdates(): boolean
Returns
boolean
Inherited from
ResolvedTable.ignoreEmptyUpdates
indexes
Get Signature
get indexes(): Index[]
Returns
Index[]
Inherited from
insertOnly
Get Signature
get insertOnly(): boolean
Returns
boolean
Inherited from
internalName
Get Signature
get internalName(): string
Returns
string
Inherited from
localOnly
Get Signature
get localOnly(): boolean
Returns
boolean
Inherited from
name
Get Signature
get name(): string
Returns
string
Inherited from
trackMetadata
Get Signature
get trackMetadata(): boolean
Returns
boolean
Inherited from
trackPrevious
Get Signature
get trackPrevious(): boolean | TrackPreviousOptions
Returns
boolean | TrackPreviousOptions
Inherited from
validName
Get Signature
get validName(): boolean
Returns
boolean
Inherited from
viewName
Get Signature
get viewName(): string
Returns
string
Inherited from
viewNameOverride
Get Signature
get viewNameOverride(): undefined | string
Returns
undefined | string
Inherited from
ResolvedTable.viewNameOverride
Methods
copyWithName()
copyWithName(name): ResolvedTable
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
toJSON()
toJSON(): {
columns: {
name: string;
type: undefined | ColumnType;
}[];
ignore_empty_update: undefined | boolean;
include_metadata: undefined | boolean;
include_old: any;
include_old_only_when_changed: boolean;
indexes: {
columns: {
ascending: undefined | boolean;
name: string;
type: ColumnType;
}[];
name: string;
}[];
insert_only: undefined | boolean;
local_only: undefined | boolean;
name: string;
view_name: string;
}
Returns
{
columns: {
name: string;
type: undefined | ColumnType;
}[];
ignore_empty_update: undefined | boolean;
include_metadata: undefined | boolean;
include_old: any;
include_old_only_when_changed: boolean;
indexes: {
columns: {
ascending: undefined | boolean;
name: string;
type: ColumnType;
}[];
name: string;
}[];
insert_only: undefined | boolean;
local_only: undefined | boolean;
name: string;
view_name: string;
}
| Name | Type |
|---|---|
columns | { name: string; type: undefined | ColumnType; }[] |
ignore_empty_update | undefined | boolean |
include_metadata | undefined | boolean |
include_old | any |
include_old_only_when_changed | boolean |
indexes | { columns: { ascending: undefined | boolean; name: string; type: ColumnType; }[]; name: string; }[] |
insert_only | undefined | boolean |
local_only | undefined | boolean |
name | string |
view_name | string |
Inherited from
validate()
validate(): void
Returns
void
Inherited from
createInsertOnly()
static createInsertOnly<Columns>(columns, options?): Table<Columns>
Type Parameters
| Type Parameter | Default type |
|---|---|
Columns extends ColumnsType | ColumnsType |
Parameters
| Parameter | Type |
|---|---|
columns | Columns |
options? | TableOptions |
Returns
Table<Columns>
createLocalOnly()
static createLocalOnly<Columns>(columns, options?): Table<Columns>
Type Parameters
| Type Parameter | Default type |
|---|---|
Columns extends ColumnsType | ColumnsType |
Parameters
| Parameter | Type |
|---|---|
columns | Columns |
options? | TableOptions |
Returns
Table<Columns>