insertFromParams
Inserts the given event Parameters into the SQLite database.
Field Configurations
Key | Type | Description | Default Value |
---|---|---|---|
"params" (required) | Object | undefined | null |
Parameters
Key | Type | Description | Default Value |
---|---|---|---|
"async" | Boolean | Specifies whether the action should perform asynchronously. | null |
"dataMapping" | Object | Used to map data from the requested object to the database table structure. | null |
"insertType" | InsertType | Type of the insert into the database. | "replace" |
"onError" | String | Event that is fired in case of an error. | null |
"onErrorType" | OnErrorType | Type of event that will be fired on error. | null |
"onSuccess" | String | Event that is fired in case of success. | null |
"onSuccessType" | OnSuccessType | Type of event that will be fired on success. | null |
"query" (required) | String | Path to the array of objects to insert | null |
"table" (required) | String | The name of the SQLite database table to insert to. | null |
Inherited
From Base Action
Base Action
Field Configurations
Key | Type | Description | Default Value |
---|---|---|---|
"dynamicParams" | Object | Dynamic params to retrieve data from a specific context e.g. a userSetting. | null |
"leadingDelimiter" | String | The leading mustache delimiter to use. | null |
"params" | Object,Array | Object containing the properties of the action. | null |
"trailingDelimiter" | String | The trailing mustache delimiter to use. | null |
"type" | String | Type name of the action. | null |
Examples
Example 1: Insert into an SQLite database from parameters
Goal: Create an insertFromParams action inserting objects from the parameters.
To achieve this the following code can be used:
{
"type": "insertFromParams",
"params": {
"table": "news",
"query": "results",
"insertType": "insertOrUpdate",
"onSuccess": "insertSuccess",
"onError": "insertError"
}
}
The query
parameter refers the objects that are to be inserted.
Result:
An insertFromParams action has been created.