|
|
@ -4,10 +4,9 @@ import ( |
|
|
|
"fmt" |
|
|
|
"os" |
|
|
|
|
|
|
|
"git.aiterp.net/rpdata/api/model/channel" |
|
|
|
|
|
|
|
"git.aiterp.net/rpdata/api/internal/store" |
|
|
|
"git.aiterp.net/rpdata/api/model/log" |
|
|
|
"git.aiterp.net/rpdata/api/models/channels" |
|
|
|
"git.aiterp.net/rpdata/api/models/logs" |
|
|
|
) |
|
|
|
|
|
|
|
func main() { |
|
|
@ -17,7 +16,7 @@ func main() { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
logs, err := log.List(32768) |
|
|
|
logs, err := logs.List(nil) |
|
|
|
if err != nil { |
|
|
|
fmt.Fprintln(os.Stderr, err) |
|
|
|
return |
|
|
@ -25,18 +24,18 @@ func main() { |
|
|
|
|
|
|
|
added := make(map[string]bool, 1024) |
|
|
|
for _, log := range logs { |
|
|
|
if added[log.Channel] { |
|
|
|
if added[log.ChannelName] { |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
_, err := channel.Ensure(log.Channel, false) |
|
|
|
_, err := channels.Ensure(log.ChannelName, false) |
|
|
|
if err != nil { |
|
|
|
fmt.Fprintln(os.Stderr, log.ID, err) |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
added[log.Channel] = true |
|
|
|
added[log.ChannelName] = true |
|
|
|
|
|
|
|
fmt.Println(log.Channel, "ensured") |
|
|
|
fmt.Println(log.ChannelName, "ensured") |
|
|
|
} |
|
|
|
} |