get imported tables
(c plugin.SubTaskContext, db dal.Dal)
| 482 | |
| 483 | // get imported tables |
| 484 | func getExportingTables(c plugin.SubTaskContext, db dal.Dal) (starrocksTables []string, err error) { |
| 485 | config := c.GetData().(*StarRocksConfig) |
| 486 | if config.DomainLayer != "" { |
| 487 | starrocksTables = utils.GetTablesByDomainLayer(config.DomainLayer) |
| 488 | if starrocksTables == nil { |
| 489 | return nil, errors.NotFound.New(fmt.Sprintf("no table found by domain layer: %s", config.DomainLayer)) |
| 490 | } |
| 491 | } else { |
| 492 | tables := config.Tables |
| 493 | allTables, err := db.AllTables() |
| 494 | if err != nil { |
| 495 | return nil, err |
| 496 | } |
| 497 | if len(tables) == 0 { |
| 498 | starrocksTables = allTables |
| 499 | } else { |
| 500 | for _, table := range allTables { |
| 501 | for _, r := range tables { |
| 502 | var ok bool |
| 503 | ok, err := regexp.Match(r, []byte(table)) |
| 504 | if err != nil { |
| 505 | return nil, err |
| 506 | } |
| 507 | if ok { |
| 508 | starrocksTables = append(starrocksTables, table) |
| 509 | } |
| 510 | } |
| 511 | } |
| 512 | } |
| 513 | } |
| 514 | return starrocksTables, nil |
| 515 | } |
| 516 | |
| 517 | var ExportDataTaskMeta = plugin.SubTaskMeta{ |
| 518 | Name: "ExportData", |
no test coverage detected