Esempio n. 1
0
func setup() {
	for i := 0; i < 1000; i++ {
		values := make(map[string]interface{})
		if i%2 == 0 {
			values["value"] = "Value 1"
		} else {
			values["value"] = "Value 2"
		}
		db.SaveIncident(domain.Incident{Values: values})
	}
}
Esempio n. 2
0
func handleCreateIncident(w http.ResponseWriter, r *http.Request) {
	err := r.ParseForm()
	if err != nil {
		http.Error(w, http.StatusText(500), 500)
	}
	incident := domain.Incident{Values: make(map[string]interface{})}
	for k, v := range r.Form {
		incident.Values[k] = v[0]
	}
	incident.Status = domain.Draft
	db.SaveIncident(incident)
	http.Redirect(w, r, "/", 301)
}