-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsource_objects.go
More file actions
38 lines (33 loc) · 940 Bytes
/
source_objects.go
File metadata and controls
38 lines (33 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
import "fmt"
// SourceObjects holds non-table source objects that require manual migration.
type SourceObjects struct {
Views []string
Routines []string
Triggers []string
}
func sourceObjectWarnings(objs *SourceObjects) []string {
if objs == nil {
return nil
}
var warnings []string
if len(objs.Views) == 0 && len(objs.Routines) == 0 && len(objs.Triggers) == 0 {
return warnings
}
warnings = append(warnings,
fmt.Sprintf(
"source contains non-table objects not migrated automatically (%d views, %d routines, %d triggers)",
len(objs.Views), len(objs.Routines), len(objs.Triggers),
),
)
for _, v := range objs.Views {
warnings = append(warnings, fmt.Sprintf("view: %s", v))
}
for _, r := range objs.Routines {
warnings = append(warnings, fmt.Sprintf("routine: %s", r))
}
for _, t := range objs.Triggers {
warnings = append(warnings, fmt.Sprintf("trigger: %s", t))
}
return warnings
}