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);
Name | Type | Description |
---|---|---|
props | TableProps | No description. |
props
Required
- Type: TableProps
Methods
Preflight Methods
Name | Description |
---|---|
addRow | Add a row to the table that is created when the app is deployed. |
Inflight Methods
Name | Description |
---|---|
delete | Delete a row from the table, by primary key. |
get | Get a row from the table, by primary key. |
insert | Insert a row into the table. |
list | List all rows in the table. |
tryGet | Get a row from the table if exists, by primary key. |
update | Update a row in the table. |
upsert | Insert 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.
key
Required
- Type: str
row
Required
- Type: Json
delete
inflight delete(key: str): void
Delete a row from the table, by primary key.
key
Required
- Type: str
primary key to delete the row.
get
inflight get(key: str): Json
Get a row from the table, by primary key.
key
Required
- Type: str
primary key to search.
insert
inflight insert(key: str, row: Json): void
Insert a row into the table.
key
Required
- Type: str
primary key to insert the row.
row
Required
- Type: Json
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.
key
Required
- Type: str
primary key to search.
update
inflight update(key: str, row: Json): void
Update a row in the table.
key
Required
- Type: str
primary key to update the row.
row
Required
- Type: Json
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.
key
Required
- Type: str
primary key to upsert the row.
row
Required
- Type: Json
data to be upserted.
Static Functions
Name | Description |
---|---|
onLiftType | A 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.
host
Required
- Type: IInflightHost
ops
Required
- Type: MutArray<str>
Properties
Name | Type | Description |
---|---|---|
node | constructs.Node | The tree node. |
columns | MutMap<ColumnType> | Table columns. |
name | str | Table name. |
primaryKey | str | Table primary key name. |
node
Required
node: Node;
- Type: constructs.Node
The tree node.
columns
Required
columns: MutMap<ColumnType>;
- Type: MutMap<ColumnType>
Table columns.
name
Required
name: str;
- Type: str
Table name.
primaryKey
Required
primaryKey: str;
- Type: str
Table primary key name.
Structs
TableProps
Properties for Table
.
Initializer
bring ex;
let TableProps = ex.TableProps{ ... };
Properties
Name | Type | Description |
---|---|---|
columns | MutMap<ColumnType> | The table's columns. |
initialRows | MutMap<Json> | The table's initial rows. |
name | str | The table's name. |
primaryKey | str | The table's primary key. |
columns
Optional
columns: MutMap<ColumnType>;
- Type: MutMap<ColumnType>
- Default: undefined
The table's columns.
initialRows
Optional
initialRows: MutMap<Json>;
- Type: MutMap<Json>
- Default: undefined
The table's initial rows.
name
Optional
name: str;
- Type: str
- Default: undefined
The table's name.
primaryKey
Optional
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
Name | Description |
---|---|
STRING | String type. |
NUMBER | Number type. |
BOOLEAN | Bool type. |
DATE | Date type. |
JSON | Json type. |
STRING
String type.
NUMBER
Number type.
BOOLEAN
Bool type.
DATE
Date type.
JSON
Json type.