package main import ( "github.com/jmoiron/sqlx" bh "github.com/timshannon/bolthold" "github.com/velour/catbase/plugins/rest" "log" "net/url" ) type WireSQL struct { rest.Wire // The URL to make a request to URL string } func migrateWires(db *sqlx.DB, store *bh.Store) error { wires := []WireSQL{} log.Printf("Migrating %T", wires) if err := db.Select(&wires, `select * from wires`); err != nil { return err } for _, w := range wires { wire := w.Wire u, _ := url.Parse(w.URL) wire.URL = rest.ScanableURL{u} if err := store.Insert(w.ID, wire); err != nil { return err } } return nil }