Skip to main content

API Reference

Resources

Table

A NoSQL database table that can be used to store and query data.

Initializers

bring ex;

new ex.Table(props: TableProps);
NameTypeDescription
propsTablePropsNo description.

propsRequired

Methods

Preflight Methods
NameDescription
addRowAdd a row to the table that is created when the app is deployed.
Inflight Methods
NameDescription
deleteDelete a row from the table, by primary key.
getGet a row from the table, by primary key.
insertInsert a row into the table.
listList all rows in the table.
tryGetGet a row from the table if exists, by primary key.
updateUpdate a row in the table.
upsertInsert a row into the table if it doesn't exist, otherwise update it.

addRow
addRow(key: str, row: Json): void

Add a row to the table that is created when the app is deployed.

keyRequired
  • Type: str

rowRequired

delete
inflight delete(key: str): void

Delete a row from the table, by primary key.

keyRequired
  • Type: str

primary key to delete the row.


get
inflight get(key: str): Json

Get a row from the table, by primary key.

keyRequired
  • Type: str

primary key to search.


insert
inflight insert(key: str, row: Json): void

Insert a row into the table.

keyRequired
  • Type: str

primary key to insert the row.


rowRequired

data to be inserted.


list
inflight list(): MutArray<Json>

List all rows in the table.

tryGet
inflight tryGet(key: str): Json?

Get a row from the table if exists, by primary key.

keyRequired
  • Type: str

primary key to search.


update
inflight update(key: str, row: Json): void

Update a row in the table.

keyRequired
  • Type: str

primary key to update the row.


rowRequired

data to be updated.


upsert
inflight upsert(key: str, row: Json): void

Insert a row into the table if it doesn't exist, otherwise update it.

keyRequired
  • Type: str

primary key to upsert the row.


rowRequired

data to be upserted.


Static Functions

NameDescription
onLiftTypeA hook called by the Wing compiler once for each inflight host that needs to use this type inflight.

onLiftType
bring ex;

ex.Table.onLiftType(host: IInflightHost, ops: MutArray<str>);

A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.

The list of requested inflight methods needed by the inflight host are given by ops.

This method is commonly used for adding permissions, environment variables, or other capabilities to the inflight host.

hostRequired

opsRequired
  • Type: MutArray<str>

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
columnsMutMap<ColumnType>Table columns.
namestrTable name.
primaryKeystrTable primary key name.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


columnsRequired
columns: MutMap<ColumnType>;

Table columns.


nameRequired
name: str;
  • Type: str

Table name.


primaryKeyRequired
primaryKey: str;
  • Type: str

Table primary key name.


Structs

TableProps

Properties for Table.

Initializer

bring ex;

let TableProps = ex.TableProps{ ... };

Properties

NameTypeDescription
columnsMutMap<ColumnType>The table's columns.
initialRowsMutMap<Json>The table's initial rows.
namestrThe table's name.
primaryKeystrThe table's primary key.

columnsOptional
columns: MutMap<ColumnType>;

The table's columns.


initialRowsOptional
initialRows: MutMap<Json>;
  • Type: MutMap<Json>
  • Default: undefined

The table's initial rows.


nameOptional
name: str;
  • Type: str
  • Default: undefined

The table's name.


primaryKeyOptional
primaryKey: str;
  • Type: str
  • Default: undefined

The table's primary key.

No two rows can have the same value for the primary key.


Enums

ColumnType

Table column types.

Members

NameDescription
STRINGString type.
NUMBERNumber type.
BOOLEANBool type.
DATEDate type.
JSONJson type.

STRING

String type.


NUMBER

Number type.


BOOLEAN

Bool type.


DATE

Date type.


JSON

Json type.