Skip to content

Commit 855a278

Browse files
authored
Merge pull request #3164 from actiontech/sqlfash_api_update_ce
Sqlfash api update ce
2 parents 458b782 + eb0d21a commit 855a278

File tree

4 files changed

+67
-6
lines changed

4 files changed

+67
-6
lines changed

sqle/docs/docs.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13083,13 +13083,16 @@ var doc = `{
1308313083
"sql_flash.AdvisedIndex": {
1308413084
"type": "object",
1308513085
"properties": {
13086+
"has_advice": {
13087+
"type": "boolean"
13088+
},
1308613089
"indexes": {
1308713090
"type": "array",
1308813091
"items": {
1308913092
"$ref": "#/definitions/sql_flash.IndexInfo"
1309013093
}
1309113094
},
13092-
"message": {
13095+
"other_advice": {
1309313096
"type": "string"
1309413097
},
1309513098
"state": {

sqle/docs/swagger.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13067,13 +13067,16 @@
1306713067
"sql_flash.AdvisedIndex": {
1306813068
"type": "object",
1306913069
"properties": {
13070+
"has_advice": {
13071+
"type": "boolean"
13072+
},
1307013073
"indexes": {
1307113074
"type": "array",
1307213075
"items": {
1307313076
"$ref": "#/definitions/sql_flash.IndexInfo"
1307413077
}
1307513078
},
13076-
"message": {
13079+
"other_advice": {
1307713080
"type": "string"
1307813081
},
1307913082
"state": {

sqle/docs/swagger.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ definitions:
3636
type: object
3737
sql_flash.AdvisedIndex:
3838
properties:
39+
has_advice:
40+
type: boolean
3941
indexes:
4042
items:
4143
$ref: '#/definitions/sql_flash.IndexInfo'
4244
type: array
43-
message:
45+
other_advice:
4446
type: string
4547
state:
4648
type: string

sqle/server/optimization/sql_flash/sql_flash_types.go

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,10 @@ func (q *TotalAnalysis) Scan(value interface{}) error {
180180

181181
// 索引建议
182182
type AdvisedIndex struct {
183-
State string `json:"state"`
184-
Message string `json:"message"`
185-
Indexes []*IndexInfo `json:"indexes"`
183+
State string `json:"state"`
184+
HasAdvice bool `json:"has_advice"`
185+
OtherAdvice string `json:"other_advice"`
186+
Indexes []*IndexInfo `json:"indexes"`
186187
}
187188

188189
// Value impl sql.driver.Valuer interface
@@ -217,3 +218,55 @@ type IndexInfo struct {
217218
CreateIndexStatement string `json:"create_index_statement"`
218219
Reason string `json:"reason"`
219220
}
221+
222+
// ========== 重写任务相关结构 ==========
223+
224+
// 创建重写任务请求
225+
type CreateRewriteTaskReq struct {
226+
Type string `json:"type"` // SQL类型:SQL 或 MyBatis
227+
Content string `json:"content"` // SQL内容(文本形式)
228+
Metadata string `json:"metadata"` // 数据库元数据信息
229+
Explain string `json:"explain"` // 执行计划信息
230+
}
231+
232+
// 创建重写任务响应
233+
type CreateRewriteTaskResp struct {
234+
Code json.Number `json:"code"`
235+
Message string `json:"message"`
236+
Data struct {
237+
TaskID string `json:"task_id"`
238+
} `json:"data"`
239+
}
240+
241+
// 重写任务结果
242+
type RewriteResult struct {
243+
ID string `json:"id"`
244+
TaskID string `json:"task_id"`
245+
OriginSQL string `json:"origin_sql"`
246+
Metadata string `json:"metadata"`
247+
OptimizeState string `json:"optimize_state"` // 优化状态:running, rewrite_done, failed等
248+
OptimizeSteps []*OptimizeStep `json:"optimize_steps"` // 优化步骤
249+
}
250+
251+
// 获取重写任务结果响应
252+
type GetRewriteResultResp struct {
253+
Code json.Number `json:"code"`
254+
Message string `json:"message"`
255+
Data *RewriteResult `json:"data"`
256+
}
257+
258+
// ========== 索引推荐任务相关结构 ==========
259+
260+
// 创建索引推荐任务请求
261+
type CreateAdviseIndexTaskReq struct {
262+
Explain string `json:"explain"` // 执行计划信息
263+
}
264+
265+
// 创建索引推荐任务响应
266+
type CreateAdviseIndexTaskResp struct {
267+
Code json.Number `json:"code"`
268+
Message string `json:"message"`
269+
Data struct {
270+
Message string `json:"message"`
271+
} `json:"data"`
272+
}

0 commit comments

Comments
 (0)