Beispiel #1
0
func (app *App) DeleteBundles(txn gorp.SqlExecutor) error {
	bundles, err := app.Bundles(txn)
	if err != nil {
		return err
	}

	args := make([]interface{}, len(bundles))
	for i, bundle := range bundles {
		args[i] = bundle
	}

	_, err = txn.Delete(args...)
	return err
}
Beispiel #2
0
func (app *App) DeleteAuthorities(txn gorp.SqlExecutor) error {
	authorities, err := app.Authorities(txn)
	if err != nil {
		return err
	}

	args := make([]interface{}, len(authorities))
	for i, authority := range authorities {
		args[i] = authority
	}

	_, err = txn.Delete(args...)
	return err
}
func DeleteIgnoreList(db gorp.SqlExecutor, parms martini.Params) (int, string) {
	id, err := strconv.Atoi(parms["id"])
	obj, _ := db.Get(models.Ignore_List{}, id)
	if err != nil || obj == nil {
		checkErr(err, "get failed")
		// Invalid id, or does not exist
		return http.StatusBadRequest, ""
	}
	entity := obj.(*models.Ignore_List)
	_, err = db.Delete(entity)
	if err != nil {
		checkErr(err, "delete failed")
		return http.StatusBadRequest, ""
	}
	return http.StatusOK, ""
}
func DeleteContact_type(db gorp.SqlExecutor, parms martini.Params) (int, string) {
	id, err := strconv.Atoi(parms["id"])
	obj, _ := db.Get(models.DefaultStruct{}, id)
	if err != nil || obj == nil {
		checkErr(err, "GET CONTACT TYPE FAILED")
		// Invalid id, or does not exist
		return http.StatusBadRequest, ""
	}
	entity := obj.(*models.DefaultStruct)
	_, err = db.Delete(entity)
	if err != nil {
		checkErr(err, "DELETE CONTACT TYPE FAILED")
		return http.StatusConflict, ""
	}
	return http.StatusBadRequest, ""
}
Beispiel #5
0
func (app *App) DeleteFromDB(txn gorp.SqlExecutor) error {
	_, err := txn.Delete(app)
	return err
}
Beispiel #6
0
func (bundle *Bundle) DeleteFromDB(txn gorp.SqlExecutor) error {
	_, err := txn.Delete(bundle)
	return err
}
Beispiel #7
0
func (user *User) Delete(txn gorp.SqlExecutor) error {
	_, err := txn.Delete(user)
	return err
}
Beispiel #8
0
func (authority *Authority) DeleteFromDB(txn gorp.SqlExecutor) error {
	_, err := txn.Delete(authority)
	return err
}
Beispiel #9
0
func (audit *Audit) Delete(txn gorp.SqlExecutor) error {
	_, err := txn.Delete(audit)
	return err
}