Delete model by id

@param model model type class
@param id    model primary key
@param <T>
@return
170068
public static <T extends Model> int deleteById(Class<T> model, Serializable id) {
        return new AnimaQuery<>(model).deleteById(id);
    }
230322
public <S extends Model> int updateById(S model, Serializable id) {
        this.where(primaryKeyColumn, id);
        String       sql             = this.buildUpdateSQL(model, null);
        List<Object> columnValueList = AnimaUtils.toColumnValues(model, false);
        columnValueList.add(id);
        return this.execute(sql, columnValueList);
    }
289815
public int deleteByIdCascade(Long id) throws SQLException {
		int count = 0;
		if (id != null) {
			Metadata metadata = queryForId(id);
			if (metadata != null) {
				count = deleteCascade(metadata);
			}
		}
		return count;
	}
1152035
def delete_model(self, model):
        """"""
        try:
            if model.json is None:
                return True
            record = Record(model.json, model=model)
            record.delete()
            db.session.commit()
        except SQLAlchemyError as e:
            if not self.handle_view_exception(e):
                flash(_('Failed to delete record. %(error)s', error=str(e)),
                      category='error')
            db.session.rollback()
            return False
        return True
256697
public static base_response delete(nitro_service client, String id) throws Exception {
		linkset deleteresource = new linkset();
		deleteresource.id = id;
		return deleteresource.delete_resource(client);
	}
989622
public function doDelete($model, $id)
    {
        if ($this->weak) {
            return;
        }

        $persistence = $this->persistence ?:
            $this->owner->persistence;

        $persistence->delete(
            $model,
            $this->id,
            $this->foreign_table
        );

        $this->id = null;
    }
593924
public static <T extends Model, S extends Serializable> void deleteBatch(Class<T> model, List<S> idList) {
        deleteBatch(model, AnimaUtils.toArray(idList));
    }
211904
def delete(self, id: int):
        
        assert isinstance(id, int)

        self.open_session()
        to_delete = self.get(id)
        self.session.delete(to_delete)
        self.save()
545079
public <S extends Model> int deleteByModel(S model) {
        this.beforeCheck();
        String       sql             = this.buildDeleteSQL(model);
        List<Object> columnValueList = AnimaUtils.toColumnValues(model, false);
        return this.execute(sql, columnValueList);
    }
1148187
@Override
  public void delete(DBIDRef id) {
    assert(!ids.contains(id));
    if(content instanceof WritableDoubleDataStore) {
      ((WritableDoubleDataStore) content).delete(id);
    }
  }
761928
@RequestMapping(value = "api/group/{groupId}", method = RequestMethod.DELETE)
    public
    @ResponseBody
    List<Group> removeGroup(Model model,
                                 @PathVariable int groupId) {
        pathOverrideService.removeGroup(groupId);
        return pathOverrideService.findAllGroups();
    }
183153
protected <T> void remove(Class<T> entityClass, Object id)
    {
        remove(entityClass, id, Boolean.TRUE);
    }
928301
public function delete($id)
    {
        return $this->model->where($this->model->getKeyName(), $id)->delete();
    }
1207496
@Override
    public void deleteById(ID id) {
        Assert.notNull(id, "id to be deleted should not be null");

        operation.deleteById(information.getCollectionName(), id, null);
    }
1023313
public void removeFromCache(String id) throws DaoManagerException{
		if (map.containsKey(id)){
			map.remove(id);
		} 
	}
1145035
public function delete(Model $m, $id)
    {
        if (!$m->id_field) {
            throw new Exception(['id_field of a model is not set. Unable to delete record.']);
        }

        $delete = $this->initQuery($m);
        $delete->mode('delete');
        $delete->where($m->id_field, $id);
        $m->hook('beforeDeleteQuery', [$delete]);

        try {
            $delete->execute();
        } catch (\PDOException $e) {
            throw new Exception([
                'Unable to delete due to query error',
                'query'      => $delete->getDebugQuery(false),
                'model'      => $m,
                'conditions' => $m->conditions,
            ], null, $e);
        }
    }
779593
@RequestMapping(value = "/api/plugins/{id}", method = RequestMethod.DELETE)
    public
    @ResponseBody
    HashMap<String, Object> deletePluginPath(Model model, @PathVariable Integer id) {
        try {
            PluginManager.getInstance().deletePluginPath(id);
        } catch (Exception e) {
        }

        return pluginInformation();
    }