yao-app-ts-types
Version:
typescript types for yao application
286 lines • 8.25 kB
JSON
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/YaoQuery.QueryDSL",
"definitions": {
"YaoQuery.QueryDSL": {
"type": "object",
"properties": {
"comment": {
"type": "string",
"description": "备注【管理字段】"
},
"select": {
"type": "array",
"items": {
"type": "string"
},
"description": "选择字段列表"
},
"from": {
"type": "string",
"description": "查询数据表名称或数据模型"
},
"wheres": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/YaoQuery.Where"
}
},
{
"$ref": "#/definitions/YaoQuery.Recordable"
}
],
"description": "数据查询条件"
},
"orders": {
"$ref": "#/definitions/YaoQuery.Orders",
"description": "排序条件"
},
"offset": {
"type": "number",
"description": "记录开始位置"
},
"limit": {
"type": "number",
"description": "读取数据的数量"
},
"page": {
"type": "number",
"description": "分页查询当前页面页码"
},
"pagesize": {
"type": "number",
"description": "每页读取记录数量"
},
"data-only": {
"type": "boolean",
"description": "设定为 true, 查询结果为 []Record; 设定为 false, 查询结果为 Paginate, 仅在设定 `page` 或 `pagesize`时有效。"
},
"groups": {
"$ref": "#/definitions/YaoQuery.Groups",
"description": "聚合字段和统计层级设置"
},
"havings": {
"type": "array",
"items": {
"$ref": "#/definitions/YaoQuery.Having"
},
"description": "聚合查询结果筛选, 仅在设定 `groups` 时有效"
},
"unions": {
"type": "array",
"items": {
"$ref": "#/definitions/YaoQuery.QueryDSL"
},
"description": "联合查询。多个查询将结果合并为一张表"
},
"query": {
"$ref": "#/definitions/YaoQuery.QueryDSL",
"description": "子查询。按 QueryDSL 描述查询逻辑,生成一张二维数据表或数值。"
},
"name": {
"type": "string",
"description": "子查询别名"
},
"joins": {
"type": "array",
"items": {
"$ref": "#/definitions/YaoQuery.Join"
},
"description": "表连接。连接数据量较大的数据表时 **不推荐使用**。| 否 |"
},
"sql": {
"$ref": "#/definitions/YaoQuery.SQL",
"description": "SQL 语句。**非必要,勿使用**"
},
"debug": {
"type": "boolean",
"description": "是否开启调试(开启后计入查询日志)"
}
},
"additionalProperties": false,
"description": "QueryDSL Gou Query Domain Specific Language"
},
"YaoQuery.Where": {
"type": "object",
"properties": {
"field": {
"type": "string",
"description": "查询字段"
},
"value": {
"type": "string",
"description": "匹配数值"
},
"op": {
"type": "string",
"description": "匹配关系运算符"
},
"or": {
"type": "string",
"description": "true 查询条件逻辑关系为 or, 默认为 false 查询条件逻辑关系为 and"
},
"query": {
"type": "string",
"description": "子查询, 如设定 query 则忽略 value 数值。"
},
"comment": {
"type": "string",
"description": "查询条件注释"
},
"wheres": {
"type": "array",
"items": {
"$ref": "#/definitions/YaoQuery.Where"
},
"description": "分组查询。用于 condition 1 and ( condition 2 OR condition 3) 的场景"
}
},
"additionalProperties": {
"description": "可以使用类似简化的操作,比如:{ \":score\": \"分数\", \"in\": [10, 20] }"
},
"description": "Where 查询条件"
},
"YaoQuery.Recordable": {
"type": "object"
},
"YaoQuery.Orders": {
"type": "array",
"items": {
"$ref": "#/definitions/YaoQuery.Order"
},
"description": "Orders 排序条件集合"
},
"YaoQuery.Order": {
"type": "object",
"properties": {
"field": {
"type": "string",
"description": "排序字段"
},
"sort": {
"type": "string",
"description": "排序方式"
},
"comment": {
"type": "string",
"description": "查询条件注释"
}
},
"required": [
"field"
],
"additionalProperties": false,
"description": "Order 排序条件"
},
"YaoQuery.Groups": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/YaoQuery.Group"
}
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"description": "Groups 聚合条件集合"
},
"YaoQuery.Group": {
"type": "object",
"properties": {
"field": {
"$ref": "#/definitions/YaoQuery.Expression",
"description": "排序字段"
},
"rollup": {
"type": "string",
"description": "同时返回多层级统计结果,对应聚合字段数值的名称。"
},
"comment": {
"type": "string",
"description": "查询条件注释"
}
},
"additionalProperties": false,
"description": "Group 聚合条件"
},
"YaoQuery.Expression": {
"type": "string"
},
"YaoQuery.Having": {
"type": "object",
"properties": {
"havings": {
"type": "array",
"items": {
"$ref": "#/definitions/YaoQuery.Having"
},
"description": "分组查询。用于 condition 1 and ( condition 2 OR condition 3) 的场景"
}
},
"additionalProperties": false,
"description": "Having 聚合结果筛选条件"
},
"YaoQuery.Join": {
"type": "object",
"properties": {
"from": {
"$ref": "#/definitions/YaoQuery.Table",
"description": "查询数据表名称或数据模型"
},
"key": {
"$ref": "#/definitions/YaoQuery.Expression",
"description": "关联连接表字段名称"
},
"foreign": {
"$ref": "#/definitions/YaoQuery.Expression",
"description": "关联目标表字段名称(需指定表名或别名)"
},
"left": {
"type": "boolean",
"description": "true 连接方式为 LEFT JOIN, 默认为 false 连接方式为 JOIN"
},
"right": {
"type": "boolean",
"description": "true 连接方式为 RIGHT JOIN, 默认为 false 连接方式为 JOIN"
},
"comment": {
"type": "string",
"description": "关联条件注释"
}
},
"additionalProperties": false,
"description": "Join 数据表连接"
},
"YaoQuery.Table": {
"type": "string"
},
"YaoQuery.SQL": {
"type": "object",
"properties": {
"stmt": {
"type": "string",
"description": "SQL 语句,不可跟其它sql查询条件一起混用"
},
"args": {
"type": "array",
"items": {},
"description": "绑定参数表"
},
"comment": {
"type": "string",
"description": "SQL语句注释"
}
},
"additionalProperties": false,
"description": "SQL 语句"
}
}
}