// DeleteBy deletes a movie.
// Demo:
// curl -i -X DELETE -u admin:password http://localhost:8080/movies/1
765045
func (c *MovieController) DeleteBy(id int64) interface{} {
	wasDel := c.Service.DeleteByID(id)
	if wasDel {
		// return the deleted movie's ID
		return iris.Map{"deleted": id}
	}
	// right here we can see that a method function can return any of those two types(map or int),
	// we don't have to specify the return type to a specific type.
	return iris.StatusBadRequest
}
1164512
func (c *Client) DeleteView(ctx context.Context, id platform.ID) error {
	return c.db.Update(func(tx *bolt.Tx) error {
		if pe := c.deleteView(ctx, tx, id); pe != nil {
			return &platform.Error{
				Err: pe,
				Op:  getOp(platform.OpDeleteView),
			}
		}
		return nil
	})
}
274639
func (l *ossObjects) DeleteObject(ctx context.Context, bucket, object string) error {
	bkt, err := l.Client.Bucket(bucket)
	if err != nil {
		logger.LogIf(ctx, err)
		return ossToObjectError(err, bucket, object)
	}

	err = bkt.DeleteObject(object)
	if err != nil {
		logger.LogIf(ctx, err)
		return ossToObjectError(err, bucket, object)
	}
	return nil
}
941091
func DeleteBySql(query string, value ...interface{}) *DeleteStmt {
	return &DeleteStmt{
		raw: raw{
			Query: query,
			Value: value,
		},
		LimitCount: -1,
	}
}
747791
func (ag *AuthGroup) Delete(db XODB) error {
	var err error

	// if doesn't exist, bail
	if !ag._exists {
		return nil
	}

	// if deleted, bail
	if ag._deleted {
		return nil
	}

	// sql query
	const sqlstr = `DELETE FROM django.auth_group WHERE id = :1`

	// run query
	XOLog(sqlstr, ag.ID)
	_, err = db.Exec(sqlstr, ag.ID)
	if err != nil {
		return err
	}

	// set deleted
	ag._deleted = true

	return nil
}
948585
func (immutable *Immutable) Delete(entries ...Entry) (*Immutable, Entries) {
	if len(entries) == 0 {
		return immutable, Entries{}
	}

	deleted := make(Entries, 0, len(entries))
	cp := immutable.copy()
	for _, e := range entries {
		deleted = append(deleted, cp.delete(e))
	}

	return cp, deleted
}
825316
func (c *Client) DeleteByQuery(indices ...string) *DeleteByQueryService {
	return NewDeleteByQueryService(c).Index(indices...)
}
471988
func (api *ProductPrivateHostAPI) FilterBy(key string, value interface{}) *ProductPrivateHostAPI {
	api.filterBy(key, value, false)
	return api
}
1361214
func (b *DeleteBuilder) OrderBy(exprs ...interface{}) *DeleteBuilder {
	b.Delete.OrderBy = makeOrderBy(exprs...)
	return b
}
451283
func (agp *AuthGroupPermission) Delete(db XODB) error {
	var err error

	// if doesn't exist, bail
	if !agp._exists {
		return nil
	}

	// if deleted, bail
	if agp._deleted {
		return nil
	}

	// sql query
	const sqlstr = `DELETE FROM auth_group_permissions WHERE id = ?`

	// run query
	XOLog(sqlstr, agp.ID)
	_, err = db.Exec(sqlstr, agp.ID)
	if err != nil {
		return err
	}

	// set deleted
	agp._deleted = true

	return nil
}
587745
func (c *Client) Delete(key string) error {
	return c.deleteRecurse(key, false)
}
1000717
func (r *sessionRepository) DeleteByToken(ctx context.Context, token string) (*sessions.Session, error) {
	conn := r.pool.Get()
	defer conn.Close()

	session, err := getSession(conn, sessionKey(token))
	if err != nil {
		return nil, err
	}
	if _, err = redigo.Int(conn.Do("DEL", sessionKey(token))); err != nil {
		return nil, errors.Wrap(err, "session deletion failed")
	}
	return session, nil
}
837339
func (api *ZoneAPI) FilterBy(key string, value interface{}) *ZoneAPI {
	api.filterBy(key, value, false)
	return api
}
965460
func (sm *ScriptMap) Delete(scriptName string) {
	sm.lock.Lock()
	defer sm.lock.Unlock()
	delete(sm.scripts, scriptName)
}
166526
func (c *Client) DeleteObject(path, objectName string) error {
	req := request{
		method:         client.DELETE,
		url:            makeURL(apiStorage, path, objectName),
		expectedStatus: http.StatusNoContent,
	}
	if _, err := c.sendRequest(req); err != nil {
		return errors.Newf(err, "failed to delete object %s/%s", path, objectName)
	}
	return nil
}
821784
func (api *CDROMAPI) FilterBy(key string, value interface{}) *CDROMAPI {
	api.filterBy(key, value, false)
	return api
}
1356545
func (api *AutoBackupAPI) FilterBy(key string, value interface{}) *AutoBackupAPI {
	api.filterBy(key, value, false)
	return api
}