package main import ( "github.com/jmoiron/sqlx" "github.com/rs/zerolog/log" bh "github.com/timshannon/bolthold" ) type untappdUser struct { ID uint64 `db:"id"` UntappdUser string `db:"untappdUser" boltholdKey:"UntappdUser"` Channel string `db:"channel"` LastCheckin int `db:"lastCheckin"` ChanNick string `db:"chanNick"` } func migrateBeers(db *sqlx.DB, store *bh.Store) error { users := []untappdUser{} err := db.Select(&users, `select * from untappd`) if err != nil { return err } for _, u := range users { err = store.Insert(u.UntappdUser, u) if err != nil { return err } } log.Printf("Migrated %d untappd users", len(users)) return nil }