// ContactsDelete removes a contact from the database
515801
func ContactsDelete(c web.C, w http.ResponseWriter, r *http.Request) {
	// Get the contact from the database
	contact, err := env.Contacts.GetContact(c.URLParams["id"])
	if err != nil {
		utils.JSONResponse(w, 404, &ContactsDeleteResponse{
			Success: false,
			Message: "Contact not found",
		})
		return
	}

	// Fetch the current session from the middleware
	session := c.Env["token"].(*models.Token)

	// Check for ownership
	if contact.Owner != session.Owner {
		utils.JSONResponse(w, 404, &ContactsDeleteResponse{
			Success: false,
			Message: "Contact not found",
		})
		return
	}

	// Perform the deletion
	err = env.Contacts.DeleteID(c.URLParams["id"])
	if err != nil {
		env.Log.WithFields(logrus.Fields{
			"error": err.Error(),
			"id":    c.URLParams["id"],
		}).Error("Unable to delete a contact")

		utils.JSONResponse(w, 500, &ContactsDeleteResponse{
			Success: false,
			Message: "Internal error (code CO/DE/01)",
		})
		return
	}

	// Write the contact to the response
	utils.JSONResponse(w, 200, &ContactsDeleteResponse{
		Success: true,
		Message: "Contact successfully removed",
	})
}
1077641
func (db *sqlDB) Delete(m Model, id string) error {
	stmt, err := db.stmts.Stmt(m)
	if err != nil {
		return err
	}

	r, err := stmt.Delete.Exec(id)
	if err != nil {
		return err
	}

	if affected, _ := r.RowsAffected(); affected == 0 {
		return ErrNoRows
	}

	return nil
}
772819
func (r *Record) Delete(args ...string) (err error) {
	switch len(args) {
	case 0:
		_, err = r.Client.Delete(r.uri("/records"), nil)
	case 1:
		_, err = r.Client.Delete(r.uri("/records/%s", args...), nil)
	case 2:
		_, err = r.Client.Delete(r.uri("/records/%s/%s", args...), nil)
	default:
		err = r.formatCallError("Delete", args...)
	}
	return
}
704631
func (r *rest) Delete(c *gin.Context) {
	if err := r.service.Remove(c.Param("profileId")); err != nil {
		c.JSON(apihelper.BuildResponseError(err))
	} else {
		c.JSON(http.StatusOK, gin.H{"message": "profile has been deleted successfully"})
	}
}
358590
func (c *UserStore) Delete(ctx context.Context, u *chronograf.User) error {
	return c.Ctrl.DeleteUser(ctx, u.Name)
}
842392
func NewDeleteManualContactsArg(EmailAddresses []string) *DeleteManualContactsArg {
	s := new(DeleteManualContactsArg)
	s.EmailAddresses = EmailAddresses
	return s
}
1173352
func (db *GoLevelDB) Delete(key []byte) {
	key = nonNilBytes(key)
	err := db.db.Delete(key, nil)
	if err != nil {
		cmn.PanicCrisis(err)
	}
}
271713
func (db *Database) Delete(id string, rev string) (string, error) {
	url, err := buildUrl(db.dbName, id)
	if err != nil {
		return "", err
	}
	var headers = make(map[string]string)
	headers["Accept"] = "application/json"
	headers["If-Match"] = rev
	resp, err := db.connection.request("DELETE", url, nil, headers, db.auth)
	if err != nil {
		return "", err
	}
	defer resp.Body.Close()
	return getRevInfo(resp)
}
570380
func (db *BytesConnectionRedis) Delete(key string, opts ...datasync.DelOption) (found bool, err error) {
	if db.closed {
		return false, fmt.Errorf("Delete(%s) called on a closed connection", key)
	}
	db.Debugf("Delete(%s)", key)

	keysToDelete := []string{}

	var keyIsPrefix bool
	for _, o := range opts {
		if _, ok := o.(*datasync.WithPrefixOpt); ok {
			keyIsPrefix = true
		}
	}
	if keyIsPrefix {
		iterator, err := db.ListKeys(key)
		if err != nil {
			return false, err
		}
		for {
			k, _, last := iterator.GetNext()
			if last {
				break
			}
			keysToDelete = append(keysToDelete, k)
		}
		if len(keysToDelete) == 0 {
			return false, nil
		}
		db.Debugf("Delete(%s): deleting %v", key, keysToDelete)
	} else {
		keysToDelete = append(keysToDelete, key)
	}

	intCmd := db.client.Del(keysToDelete...)
	if intCmd.Err() != nil {
		return false, fmt.Errorf("Delete(%s) failed: %s", key, intCmd.Err())
	}
	return (intCmd.Val() != 0), nil
}
330977
func (m *dbConn) Delete(key driver.Value) (int, error) {
	txn := m.db.Txn(true)
	err := txn.Delete(m.md.tbl.Name, key)
	if err != nil {
		txn.Abort()
		u.Warnf("could not delete: %v  err=%v", key, err)
		return 0, err
	}
	txn.Commit()
	return 1, nil
}
375406
func (r *SdkRoleManager) Delete(
	ctx context.Context,
	req *api.SdkRoleDeleteRequest,
) (*api.SdkRoleDeleteResponse, error) {
	if len(req.GetName()) == 0 {
		return nil, status.Error(codes.InvalidArgument, "Must supply a name for role")
	}

	// Determine if there is collision with default roles
	if _, ok := defaultRoles[req.GetName()]; ok {
		return nil, status.Errorf(
			codes.InvalidArgument,
			"Cannot delete system role %s", req.GetName())
	}

	_, err := r.kv.Delete(prefixWithName(req.GetName()))
	if err != kvdb.ErrNotFound && err != nil {
		return nil, status.Errorf(codes.Internal, "Failed to delete role %s: %v", req.GetName(), err)
	}

	return &api.SdkRoleDeleteResponse{}, nil
}
818201
func (s *DB) Delete(value interface{}, where ...interface{}) *DB {
	return s.NewScope(value).inlineCondition(where...).callCallbacks(s.parent.callbacks.deletes).db
}
128320
func (m *StaticDataSource) Delete(key driver.Value) (int, error) {
	item := m.bt.Delete(NewKey(makeId(key)))
	if item == nil {
		//u.Warnf("could not delete: %v", key)
		return 0, schema.ErrNotFound
	}
	return 1, nil
}
650890
func Delete(doc *utils.M) error {
	return db.Conn.Delete(db.AvailableTopicCollection, *doc)
}
459882
func (kv *KV) Delete(key []byte) error {
	return kv.db.Update(func(txn *badger.Txn) error {
		return txn.Delete(key)
	})
}
1365237
func (s *Store) Delete(ctx context.Context, name string) error {
	return s.delete(ctx, name, false)
}
898697
func (c *Client) CollaboratorDelete(appIdentity string, collaboratorIdentity string) error {
	return c.Delete("/apps/" + appIdentity + "/collaborators/" + collaboratorIdentity)
}