QuerySelectExpression 查询选择子句
1. 结构声明
- TS Declaration
- JSON Schema
class QuerySelectExpression extends LogicItem {
distinct: boolean = false;
star: boolean = true;
selectElements: Array<QueryAggregateExpression | QueryFieldExpression> = [];
}
{
"type": "object",
"properties": {
"label": {
"type": "string"
},
"description": {
"type": "string"
},
"folded": {
"type": "boolean"
},
"offsetX": {
"type": "number"
},
"offsetY": {
"type": "number"
},
"distinct": {
"type": "boolean"
},
"star": {
"type": "boolean"
},
"selectElements": {
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/definitions/QueryAggregateExpression"
},
{
"$ref": "#/definitions/QueryFieldExpression"
}
]
}
}
},
"required": [
"distinct",
"star",
"selectElements"
],
"additionalProperties": false
}
2. 节点示例
(1) 示例
AST 如下:
- JSON
- YAML
{
"concept": "QuerySelectExpression",
"distinct": false,
"star": true,
"selectElements": [
{
"concept": "QueryFieldExpression",
"isDotStar": true,
"entityAsName": "Product",
"propertyName": "",
"asName": ""
}
]
}
concept: QuerySelectExpression
distinct: false
star: true
selectElements:
- concept: QueryFieldExpression
isDotStar: true
entityAsName: Product
propertyName: ""
asName: ""
(2) 示例
AST 如下:
- JSON
- YAML
{
"concept": "QuerySelectExpression",
"distinct": false,
"star": true,
"selectElements": [
{
"concept": "QueryFieldExpression",
"isDotStar": true,
"entityAsName": "OrderProduct",
"propertyName": "",
"asName": ""
},
{
"concept": "QueryFieldExpression",
"isDotStar": true,
"entityAsName": "OrderForm",
"propertyName": "",
"asName": ""
},
{
"concept": "QueryFieldExpression",
"isDotStar": true,
"entityAsName": "Product",
"propertyName": "",
"asName": ""
},
{
"concept": "QueryAggregateExpression",
"asName": "totalAmount",
"aggregateName": "SUM",
"aggregateParam": {
"concept": "QueryFieldExpression",
"isDotStar": false,
"entityAsName": "OrderProduct",
"propertyName": "amount",
"asName": ""
}
}
]
}
concept: QuerySelectExpression
distinct: false
star: true
selectElements:
- concept: QueryFieldExpression
isDotStar: true
entityAsName: OrderProduct
propertyName: ""
asName: ""
- concept: QueryFieldExpression
isDotStar: true
entityAsName: OrderForm
propertyName: ""
asName: ""
- concept: QueryFieldExpression
isDotStar: true
entityAsName: Product
propertyName: ""
asName: ""
- concept: QueryAggregateExpression
asName: totalAmount
aggregateName: SUM
aggregateParam:
concept: QueryFieldExpression
isDotStar: false
entityAsName: OrderProduct
propertyName: amount
asName: ""