(comment string)
| 515 | } |
| 516 | |
| 517 | func extractSourceTable(comment string) (string, string, string, error) { |
| 518 | pattern := `\((\w+),\s*(\w+)(?:,\s*(\w+))?\)` |
| 519 | re := regexp.MustCompile(pattern) |
| 520 | |
| 521 | matches := re.FindStringSubmatch(comment) |
| 522 | |
| 523 | if len(matches) == 3 || (len(matches) == 4 && matches[3] == "") { |
| 524 | databaseName := matches[1] |
| 525 | tableName := matches[2] |
| 526 | return databaseName, "", tableName, nil |
| 527 | } else if len(matches) == 4 { |
| 528 | databaseName := matches[1] |
| 529 | schemaName := matches[2] |
| 530 | tableName := matches[3] |
| 531 | return databaseName, schemaName, tableName, nil |
| 532 | } |
| 533 | |
| 534 | return "", "", "", errors.Errorf("failed to extract source table from comment: %s", comment) |
| 535 | } |
| 536 | |
| 537 | func getSchemaMetadata(engine storepb.Engine, dbMetadata *model.DatabaseMetadata) *model.SchemaMetadata { |
| 538 | switch engine { |
no test coverage detected