Esempio n. 1
0
func UpdateMetadata(self *ss.AppServer, w http.ResponseWriter, req *http.Request) error {
	job, err := ss.NewAsyncMetadataUpdate(req)
	if err != nil {
		ss.SendJSON(w, false)
		return err
	}
	err = self.UpdateEntry(job)
	if err != nil {
		ss.SendJSON(w, false)
		return err
	}
	ss.SendJSON(w, true)
	return nil
}
Esempio n. 2
0
// deleteRows handles the deletion of a group of rows from a table.
func DeleteRows(self *ss.AppServer, w http.ResponseWriter, req *http.Request) error {

	job, err := ss.NewAsyncDelete(req)
	if err != nil {
		ss.SendJSONError(w, err)
		return err
	}
	err = self.DeleteEntries(job)
	if err != nil {
		ss.SendJSONError(w, err)
	}

	ss.SendJSON(w, true)
	return nil
}
Esempio n. 3
0
// InsertData server as the back-end for handling data insertion into
// existing tables.  The request holds all the relevent data encoded
// into rows.
func InsertData(self *ss.AppServer, w http.ResponseWriter, req *http.Request) error {

	job, err := ss.NewAsyncInsert(req)
	if err != nil {
		ss.SendJSONError(w, err)
		return err
	}

	err = self.InsertEntry(job)
	if err != nil {
		ss.SendJSONError(w, err)
		return err
	}

	ss.SendJSON(w, true)
	return nil
}
Esempio n. 4
0
// This is a handler which checks the POST for the data required to
// make a change to the database.
//
// This function will have one of two possible side effects which are
// writing a JSON response to the caller.
func ChangeTable(self *ss.AppServer, w http.ResponseWriter, req *http.Request) error {

	job, err := ss.NewAsyncJob(req)
	if err != nil {
		ss.SendJSON(w, false)
		return err
	}

	err = self.WriteEntry(job)
	if err != nil {
		ss.SendJSON(w, false)
		return err
	}

	ss.SendJSON(w, true)
	return nil
}