This commit is contained in:
@@ -28,20 +28,26 @@ var syncCmd = &cobra.Command{
|
||||
if config.Verbose > 2 {
|
||||
slog.Info("Size of targetData", "size", reflect.TypeOf(targetData).Size())
|
||||
}
|
||||
// find missing items in target and collect items not available in source
|
||||
for table, item_list := range sourceData.GetMap() {
|
||||
slog.Info("iterate sourceData", "table", table, "count", reflect.TypeOf(item_list).Size())
|
||||
switch table {
|
||||
case "sports":
|
||||
sourceData.Sport.CompareIds(&targetData.Sport)
|
||||
case "players":
|
||||
sourceData.Player.CompareIds(&targetData.Player)
|
||||
slog.Info("iterate sourceData", "table", "Sport", "count", len(sourceData.Sport))
|
||||
sourceData.Sport.CompareIds(&targetData.Sport)
|
||||
slog.Info("iterate sourceData", "table", "Player", "count", len(sourceData.Player))
|
||||
sourceData.Player.CompareIds(&targetData.Player)
|
||||
slog.Info("iterate sourceData", "table", "MediaLofi", "count source", len(sourceData.MediaLoFi), "count target", len(targetData.MediaLoFi))
|
||||
missing, obsolete := sourceData.MediaLoFi.CompareIds(&targetData.MediaLoFi)
|
||||
for _, lofi_id := range missing {
|
||||
if !config.DryRun {
|
||||
slog.Info("add MediaLofi", "id", lofi_id)
|
||||
}
|
||||
}
|
||||
for _, lofi_id := range obsolete {
|
||||
if !config.DryRun {
|
||||
slog.Info("delete MediaLofi", "id", lofi_id)
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(syncCmd)
|
||||
syncCmd.PersistentFlags().BoolVarP(&config.DryRun, "dry-run", "m", false, "do not execute data changes")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user