|
|
@@ -154,137 +154,75 @@ func (c *Client) DeleteTable(ctx context.Context, tableID string) error {
|
|
154
|
154
|
return nil
|
|
155
|
155
|
}
|
|
156
|
156
|
|
|
157
|
|
-// ListTableAliases 查询表别名字典列表
|
|
158
|
|
-func (c *Client) ListTableAliases(ctx context.Context, query *TableAliasQueryRequest) (*TableAliasList, error) {
|
|
159
|
|
- endpoint := "/api/dic-table-alias/list"
|
|
|
157
|
+// BatchSaveTables 批量保存数据库表字典
|
|
|
158
|
+func (c *Client) BatchSaveTables(ctx context.Context, req *BatchSaveDicTablesRequest) error {
|
|
|
159
|
+ endpoint := "/api/dic-table/batch-save"
|
|
160
|
160
|
|
|
161
|
|
- var result ResponseWrapper[[]DicTableAliasDB]
|
|
162
|
|
- if err := c.doRequest(ctx, http.MethodPost, endpoint, query, &result); err != nil {
|
|
163
|
|
- return nil, err
|
|
|
161
|
+ var result ResponseWrapper[bool]
|
|
|
162
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
|
163
|
+ return err
|
|
164
|
164
|
}
|
|
165
|
165
|
|
|
166
|
166
|
if !result.Success {
|
|
167
|
|
- return nil, NewClientError("list_table_aliases", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
167
|
+ return NewClientError("batch_save_tables", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
168
|
168
|
}
|
|
169
|
169
|
|
|
170
|
|
- return &TableAliasList{
|
|
171
|
|
- TotalCount: result.TotalCount,
|
|
172
|
|
- LastPage: result.LastPage,
|
|
173
|
|
- Data: result.Data,
|
|
174
|
|
- }, nil
|
|
|
170
|
+ return nil
|
|
175
|
171
|
}
|
|
176
|
172
|
|
|
177
|
|
-// GetTableAlias 查询表别名字典详情
|
|
178
|
|
-func (c *Client) GetTableAlias(ctx context.Context, id string) (*TableAliasDetail, error) {
|
|
179
|
|
- endpoint := fmt.Sprintf("/api/dic-table-alias/detail/%s", id)
|
|
|
173
|
+// BatchSyncTables 批量同步表字典
|
|
|
174
|
+func (c *Client) BatchSyncTables(ctx context.Context, req *BatchTableSyncRequest) (*BatchTableSyncResponse, error) {
|
|
|
175
|
+ endpoint := "/api/dic-table/batch-sync"
|
|
180
|
176
|
|
|
181
|
|
- var result ResponseWrapper[TableAliasDetail]
|
|
182
|
|
- if err := c.doRequest(ctx, http.MethodPost, endpoint, nil, &result); err != nil {
|
|
|
177
|
+ var result ResponseWrapper[BatchTableSyncResponse]
|
|
|
178
|
+ if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
183
|
179
|
return nil, err
|
|
184
|
180
|
}
|
|
185
|
181
|
|
|
186
|
182
|
if !result.Success {
|
|
187
|
|
- if result.Error == "not found" || strings.Contains(result.Error, "不存在") {
|
|
188
|
|
- return nil, ErrNotFound
|
|
189
|
|
- }
|
|
190
|
|
- return nil, NewClientError("get_table_alias", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
183
|
+ return nil, NewClientError("batch_sync_tables", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
191
|
184
|
}
|
|
192
|
185
|
|
|
193
|
186
|
return &result.Data, nil
|
|
194
|
187
|
}
|
|
195
|
188
|
|
|
196
|
|
-// SaveTableAlias 创建或更新表别名字典
|
|
197
|
|
-func (c *Client) SaveTableAlias(ctx context.Context, req *TableAliasRequest) (*TableAliasDetail, error) {
|
|
198
|
|
- endpoint := "/api/dic-table-alias/save"
|
|
|
189
|
+// BatchSyncAliases 批量同步别名
|
|
|
190
|
+func (c *Client) BatchSyncAliases(ctx context.Context, req *BatchAliasSyncRequest) (*BatchAliasSyncResponse, error) {
|
|
|
191
|
+ endpoint := "/api/alias/batch-sync"
|
|
199
|
192
|
|
|
200
|
|
- var result ResponseWrapper[TableAliasDetail]
|
|
|
193
|
+ var result ResponseWrapper[BatchAliasSyncResponse]
|
|
201
|
194
|
if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
202
|
195
|
return nil, err
|
|
203
|
196
|
}
|
|
204
|
197
|
|
|
205
|
198
|
if !result.Success {
|
|
206
|
|
- return nil, NewClientError("save_table_alias", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
199
|
+ return nil, NewClientError("batch_sync_aliases", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
207
|
200
|
}
|
|
208
|
201
|
|
|
209
|
202
|
return &result.Data, nil
|
|
210
|
203
|
}
|
|
211
|
204
|
|
|
212
|
|
-// BatchSaveTableAliases 批量保存表别名字典
|
|
213
|
|
-func (c *Client) BatchSaveTableAliases(ctx context.Context, req *BatchTableAliasRequest) ([]TableAliasDetail, error) {
|
|
214
|
|
- endpoint := "/api/dic-table-alias/batch-save"
|
|
|
205
|
+// SaveTableAlias 保存表别名字典
|
|
|
206
|
+func (c *Client) SaveTableAlias(ctx context.Context, req *TableAliasRequest) (*TableAliasResponse, error) {
|
|
|
207
|
+ endpoint := "/api/dic-table-alias/save"
|
|
215
|
208
|
|
|
216
|
|
- var result ResponseWrapper[[]TableAliasDetail]
|
|
|
209
|
+ var result ResponseWrapper[TableAliasResponse]
|
|
217
|
210
|
if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
218
|
211
|
return nil, err
|
|
219
|
212
|
}
|
|
220
|
213
|
|
|
221
|
214
|
if !result.Success {
|
|
222
|
|
- return nil, NewClientError("batch_save_table_aliases", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
223
|
|
- }
|
|
224
|
|
-
|
|
225
|
|
- return result.Data, nil
|
|
226
|
|
-}
|
|
227
|
|
-
|
|
228
|
|
-// DeleteTableAlias 删除表别名字典
|
|
229
|
|
-func (c *Client) DeleteTableAlias(ctx context.Context, id string) error {
|
|
230
|
|
- endpoint := fmt.Sprintf("/api/dic-table-alias/delete/%s", id)
|
|
231
|
|
-
|
|
232
|
|
- var result ResponseWrapper[int64]
|
|
233
|
|
- if err := c.doRequest(ctx, http.MethodPost, endpoint, nil, &result); err != nil {
|
|
234
|
|
- return err
|
|
235
|
|
- }
|
|
236
|
|
-
|
|
237
|
|
- if !result.Success {
|
|
238
|
|
- return NewClientError("delete_table_alias", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
239
|
|
- }
|
|
240
|
|
-
|
|
241
|
|
- return nil
|
|
242
|
|
-}
|
|
243
|
|
-
|
|
244
|
|
-// ListTableFieldAliases 查询字段别名字典列表
|
|
245
|
|
-func (c *Client) ListTableFieldAliases(ctx context.Context, query *TableFieldAliasQueryRequest) (*TableFieldAliasList, error) {
|
|
246
|
|
- endpoint := "/api/dic-table-field-alias/list"
|
|
247
|
|
-
|
|
248
|
|
- var result ResponseWrapper[[]DicTableFieldAliasDB]
|
|
249
|
|
- if err := c.doRequest(ctx, http.MethodPost, endpoint, query, &result); err != nil {
|
|
250
|
|
- return nil, err
|
|
251
|
|
- }
|
|
252
|
|
-
|
|
253
|
|
- if !result.Success {
|
|
254
|
|
- return nil, NewClientError("list_table_field_aliases", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
255
|
|
- }
|
|
256
|
|
-
|
|
257
|
|
- return &TableFieldAliasList{
|
|
258
|
|
- TotalCount: result.TotalCount,
|
|
259
|
|
- LastPage: result.LastPage,
|
|
260
|
|
- Data: result.Data,
|
|
261
|
|
- }, nil
|
|
262
|
|
-}
|
|
263
|
|
-
|
|
264
|
|
-// GetTableFieldAlias 查询字段别名字典详情
|
|
265
|
|
-func (c *Client) GetTableFieldAlias(ctx context.Context, id string) (*TableFieldAliasDetail, error) {
|
|
266
|
|
- endpoint := fmt.Sprintf("/api/dic-table-field-alias/detail/%s", id)
|
|
267
|
|
-
|
|
268
|
|
- var result ResponseWrapper[TableFieldAliasDetail]
|
|
269
|
|
- if err := c.doRequest(ctx, http.MethodPost, endpoint, nil, &result); err != nil {
|
|
270
|
|
- return nil, err
|
|
271
|
|
- }
|
|
272
|
|
-
|
|
273
|
|
- if !result.Success {
|
|
274
|
|
- if result.Error == "not found" || strings.Contains(result.Error, "不存在") {
|
|
275
|
|
- return nil, ErrNotFound
|
|
276
|
|
- }
|
|
277
|
|
- return nil, NewClientError("get_table_field_alias", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
215
|
+ return nil, NewClientError("save_table_alias", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
278
|
216
|
}
|
|
279
|
217
|
|
|
280
|
218
|
return &result.Data, nil
|
|
281
|
219
|
}
|
|
282
|
220
|
|
|
283
|
|
-// SaveTableFieldAlias 创建或更新字段别名字典
|
|
284
|
|
-func (c *Client) SaveTableFieldAlias(ctx context.Context, req *TableFieldAliasRequest) (*TableFieldAliasDetail, error) {
|
|
|
221
|
+// SaveTableFieldAlias 保存表字段别名字典
|
|
|
222
|
+func (c *Client) SaveTableFieldAlias(ctx context.Context, req *TableFieldAliasRequest) (*TableFieldAliasResponse, error) {
|
|
285
|
223
|
endpoint := "/api/dic-table-field-alias/save"
|
|
286
|
224
|
|
|
287
|
|
- var result ResponseWrapper[TableFieldAliasDetail]
|
|
|
225
|
+ var result ResponseWrapper[TableFieldAliasResponse]
|
|
288
|
226
|
if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
289
|
227
|
return nil, err
|
|
290
|
228
|
}
|
|
|
@@ -296,142 +234,46 @@ func (c *Client) SaveTableFieldAlias(ctx context.Context, req *TableFieldAliasRe
|
|
296
|
234
|
return &result.Data, nil
|
|
297
|
235
|
}
|
|
298
|
236
|
|
|
299
|
|
-// BatchSaveTableFieldAliases 批量保存字段别名字典
|
|
300
|
|
-func (c *Client) BatchSaveTableFieldAliases(ctx context.Context, req *BatchTableFieldAliasRequest) ([]TableFieldAliasDetail, error) {
|
|
301
|
|
- endpoint := "/api/dic-table-field-alias/batch-save"
|
|
302
|
|
-
|
|
303
|
|
- var result ResponseWrapper[[]TableFieldAliasDetail]
|
|
304
|
|
- if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
305
|
|
- return nil, err
|
|
306
|
|
- }
|
|
307
|
|
-
|
|
308
|
|
- if !result.Success {
|
|
309
|
|
- return nil, NewClientError("batch_save_table_field_aliases", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
310
|
|
- }
|
|
311
|
|
-
|
|
312
|
|
- return result.Data, nil
|
|
313
|
|
-}
|
|
314
|
|
-
|
|
315
|
|
-// DeleteTableFieldAlias 删除字段别名字典
|
|
316
|
|
-func (c *Client) DeleteTableFieldAlias(ctx context.Context, id string) error {
|
|
317
|
|
- endpoint := fmt.Sprintf("/api/dic-table-field-alias/delete/%s", id)
|
|
318
|
|
-
|
|
319
|
|
- var result ResponseWrapper[int64]
|
|
320
|
|
- if err := c.doRequest(ctx, http.MethodPost, endpoint, nil, &result); err != nil {
|
|
321
|
|
- return err
|
|
322
|
|
- }
|
|
323
|
|
-
|
|
324
|
|
- if !result.Success {
|
|
325
|
|
- return NewClientError("delete_table_field_alias", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
326
|
|
- }
|
|
327
|
|
-
|
|
328
|
|
- return nil
|
|
329
|
|
-}
|
|
330
|
|
-
|
|
331
|
|
-// ListTableAliasFlow 查询表别名字典流水列表
|
|
332
|
|
-func (c *Client) ListTableAliasFlow(ctx context.Context, query *TableAliasFlowQueryRequest) (*TableAliasFlowList, error) {
|
|
333
|
|
- endpoint := "/api/dic-table-alias-flow/list"
|
|
|
237
|
+// ListTableAliases 查询表别名字典列表
|
|
|
238
|
+func (c *Client) ListTableAliases(ctx context.Context, query *TableAliasQueryRequest) (*TableAliasList, error) {
|
|
|
239
|
+ endpoint := "/api/dic-table-alias/list"
|
|
334
|
240
|
|
|
335
|
|
- var result ResponseWrapper[[]DicTableAliasFlowDB]
|
|
|
241
|
+ var result ResponseWrapper[[]TableAliasResponse]
|
|
336
|
242
|
if err := c.doRequest(ctx, http.MethodPost, endpoint, query, &result); err != nil {
|
|
337
|
243
|
return nil, err
|
|
338
|
244
|
}
|
|
339
|
245
|
|
|
340
|
246
|
if !result.Success {
|
|
341
|
|
- return nil, NewClientError("list_table_alias_flow", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
247
|
+ return nil, NewClientError("list_table_aliases", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
342
|
248
|
}
|
|
343
|
249
|
|
|
344
|
|
- return &TableAliasFlowList{
|
|
|
250
|
+ return &TableAliasList{
|
|
345
|
251
|
TotalCount: result.TotalCount,
|
|
346
|
252
|
LastPage: result.LastPage,
|
|
347
|
253
|
Data: result.Data,
|
|
348
|
254
|
}, nil
|
|
349
|
255
|
}
|
|
350
|
256
|
|
|
351
|
|
-// BatchSaveTableAliasFlow 批量保存表别名字典流水
|
|
352
|
|
-func (c *Client) BatchSaveTableAliasFlow(ctx context.Context, req *BatchTableAliasRequest) ([]DicTableAliasFlowDB, error) {
|
|
353
|
|
- endpoint := "/api/dic-table-alias-flow/batch-save"
|
|
354
|
|
-
|
|
355
|
|
- var result ResponseWrapper[[]DicTableAliasFlowDB]
|
|
356
|
|
- if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
357
|
|
- return nil, err
|
|
358
|
|
- }
|
|
359
|
|
-
|
|
360
|
|
- if !result.Success {
|
|
361
|
|
- return nil, NewClientError("batch_save_table_alias_flow", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
362
|
|
- }
|
|
363
|
|
-
|
|
364
|
|
- return result.Data, nil
|
|
365
|
|
-}
|
|
366
|
|
-
|
|
367
|
|
-// BatchApprovalTableAliasFlow 批量审批表别名字典流水
|
|
368
|
|
-func (c *Client) BatchApprovalTableAliasFlow(ctx context.Context, req *BatchApprovalFlowRequest) error {
|
|
369
|
|
- endpoint := "/api/dic-table-alias-flow/batch-approval"
|
|
370
|
|
-
|
|
371
|
|
- var result ResponseWrapper[int64]
|
|
372
|
|
- if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
373
|
|
- return err
|
|
374
|
|
- }
|
|
375
|
|
-
|
|
376
|
|
- if !result.Success {
|
|
377
|
|
- return NewClientError("batch_approval_table_alias_flow", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
378
|
|
- }
|
|
379
|
|
-
|
|
380
|
|
- return nil
|
|
381
|
|
-}
|
|
382
|
|
-
|
|
383
|
|
-// ListTableFieldAliasFlow 查询字段别名字典流水列表
|
|
384
|
|
-func (c *Client) ListTableFieldAliasFlow(ctx context.Context, query *TableFieldAliasFlowQueryRequest) (*TableFieldAliasFlowList, error) {
|
|
385
|
|
- endpoint := "/api/dic-table-field-alias-flow/list"
|
|
|
257
|
+// ListTableFieldAliases 查询表字段别名字典列表
|
|
|
258
|
+func (c *Client) ListTableFieldAliases(ctx context.Context, query *TableFieldAliasQueryRequest) (*TableFieldAliasList, error) {
|
|
|
259
|
+ endpoint := "/api/dic-table-field-alias/list"
|
|
386
|
260
|
|
|
387
|
|
- var result ResponseWrapper[[]DicTableFieldAliasFlowDB]
|
|
|
261
|
+ var result ResponseWrapper[[]TableFieldAliasResponse]
|
|
388
|
262
|
if err := c.doRequest(ctx, http.MethodPost, endpoint, query, &result); err != nil {
|
|
389
|
263
|
return nil, err
|
|
390
|
264
|
}
|
|
391
|
265
|
|
|
392
|
266
|
if !result.Success {
|
|
393
|
|
- return nil, NewClientError("list_table_field_alias_flow", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
|
267
|
+ return nil, NewClientError("list_table_field_aliases", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
394
|
268
|
}
|
|
395
|
269
|
|
|
396
|
|
- return &TableFieldAliasFlowList{
|
|
|
270
|
+ return &TableFieldAliasList{
|
|
397
|
271
|
TotalCount: result.TotalCount,
|
|
398
|
272
|
LastPage: result.LastPage,
|
|
399
|
273
|
Data: result.Data,
|
|
400
|
274
|
}, nil
|
|
401
|
275
|
}
|
|
402
|
276
|
|
|
403
|
|
-// BatchSaveTableFieldAliasFlow 批量保存字段别名字典流水
|
|
404
|
|
-func (c *Client) BatchSaveTableFieldAliasFlow(ctx context.Context, req *BatchTableFieldAliasRequest) ([]DicTableFieldAliasFlowDB, error) {
|
|
405
|
|
- endpoint := "/api/dic-table-field-alias-flow/batch-save"
|
|
406
|
|
-
|
|
407
|
|
- var result ResponseWrapper[[]DicTableFieldAliasFlowDB]
|
|
408
|
|
- if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
409
|
|
- return nil, err
|
|
410
|
|
- }
|
|
411
|
|
-
|
|
412
|
|
- if !result.Success {
|
|
413
|
|
- return nil, NewClientError("batch_save_table_field_alias_flow", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
414
|
|
- }
|
|
415
|
|
-
|
|
416
|
|
- return result.Data, nil
|
|
417
|
|
-}
|
|
418
|
|
-
|
|
419
|
|
-// BatchApprovalTableFieldAliasFlow 批量审批字段别名字典流水
|
|
420
|
|
-func (c *Client) BatchApprovalTableFieldAliasFlow(ctx context.Context, req *BatchApprovalFlowRequest) error {
|
|
421
|
|
- endpoint := "/api/dic-table-field-alias-flow/batch-approval"
|
|
422
|
|
-
|
|
423
|
|
- var result ResponseWrapper[int64]
|
|
424
|
|
- if err := c.doRequest(ctx, http.MethodPost, endpoint, req, &result); err != nil {
|
|
425
|
|
- return err
|
|
426
|
|
- }
|
|
427
|
|
-
|
|
428
|
|
- if !result.Success {
|
|
429
|
|
- return NewClientError("batch_approval_table_field_alias_flow", fmt.Sprintf("API error: %s", result.Error), nil)
|
|
430
|
|
- }
|
|
431
|
|
-
|
|
432
|
|
- return nil
|
|
433
|
|
-}
|
|
434
|
|
-
|
|
435
|
277
|
// doRequest 执行HTTP请求
|
|
436
|
278
|
func (c *Client) doRequest(ctx context.Context, method, endpoint string, body interface{}, result interface{}) error {
|
|
437
|
279
|
// 构建URL
|