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