func main() { table.Start() rows, err := table.GetDb().Query(` SELECT question_id, idx, hint FROM hints `) if err != nil { log.Fatal(err) } defer rows.Close() for rows.Next() { var h hints if err := rows.Scan(&h.QuestionId, &h.Idx, &h.Hint); err != nil { log.Fatal(err) } var query string if h.Idx == 1 { query = "UPDATE questions SET hint_one = ? WHERE question_id = ?" } else { query = "UPDATE questions SET hint_two = ? WHERE question_id = ?" } _, err := table.GetDb().Exec(query, h.Hint, h.QuestionId) if err != nil { log.Fatal(err) } } }
func main() { table.Start() if err := api.Start(); err != nil { debug.PrintStack() panic(err) } }