package main import ( "fmt" "os" "git.aiterp.net/rpdata/api/internal/store" "git.aiterp.net/rpdata/api/models/channels" "git.aiterp.net/rpdata/api/models/logs" ) func main() { err := store.Init() if err != nil { fmt.Fprintln(os.Stderr, err) return } logs, err := logs.List(nil) if err != nil { fmt.Fprintln(os.Stderr, err) return } added := make(map[string]bool, 1024) for _, log := range logs { if added[log.ChannelName] { continue } _, err := channels.Ensure(log.ChannelName, false) if err != nil { fmt.Fprintln(os.Stderr, log.ID, err) continue } added[log.ChannelName] = true fmt.Println(log.ChannelName, "ensured") } }