| 335 | } |
| 336 | |
| 337 | func TargetToSourceRewrites(databaseRewrites map[string]string) (map[string]string, error) { |
| 338 | targetToSourceRewrites := make(map[string]string) |
| 339 | |
| 340 | for sourceVal, targetVal := range databaseRewrites { |
| 341 | if _, exists := targetToSourceRewrites[targetVal]; exists { |
| 342 | return nil, errors.New("duplicate target to source rewrite detected") |
| 343 | } |
| 344 | targetToSourceRewrites[targetVal] = sourceVal |
| 345 | } |
| 346 | |
| 347 | return targetToSourceRewrites, nil |
| 348 | } |
| 349 | |
| 350 | // Helper to sort a given map of tables with a second list giving a priority. |
| 351 | // If an element is present in the input and the priority lists, the item will |