SQL
Run complex sql queries and process data without writing any code
Queries are a way to interact with data
You could execute queries via
GET /productsParameters are used to pass external data into application
{
"type": "sql-select",
"id": "get-products",
"connection": "sample-database-connection",
"query": "SELECT * FROM `product` where appConfigId = :configId (id IN(:id) or name like %:name%)",
"resultType": "list",
"public": false,
"permissions": [
"admin",
"user"
],
"params": [
{
"name": "name",
"list": false,
"type": "string",
"required": false
},
{
"name": "configId",
"serverValue": "$.config.someToken",
"type": "string",
"required": false
},
{
"name": "notUsedDataFromCurrentUser",
"serverValue": "$.user.otherData.test",
"type": "string",
"required": false
},
{
"name": "id",
"type": "int",
"required": true,
"list": true,
"default": [0]
}
]
}
public - determine if you can call this query from admin panel or not. You could create insert-order-item query that should be accessible only from internal javascript logic
serverValue - this option can be used to extract data from configuration or current user using special variables $.user or $.config
permissions - roles that are allowed to execute particular query
Each query MUST contains params section
{
"someToken": "thisIsSomeRandomToken"
}
[
{
"login": "demo",
"password": "demo",
"permissions": ["admin"],
"id": 1,
"otherData": {
"test": 1
}
}
]
You could create rest endpoint to call get-products query by creating one file
{
"path": "/products/{id}",
"methods": [
"POST"
],
"query": "get-products",
"authorized": false
}
{
"name": "exampleUsername"
}
As the result you will get json response with list of products that are matching this sql value
Run complex sql queries and process data without writing any code
Javascript runtime allows you to define custom logic to interact with data