Exemplo n.º 1
0
func (b *preparedsKeyspace) Delete(deletes []string) ([]string, errors.Error) {
	for i, name := range deletes {
		err := plan.DeletePrepared(name)
		if err != nil {
			deleted := make([]string, i)
			if i > 0 {
				copy(deleted, deletes[0:i-1])
			}
			return deleted, err
		}
	}
	return deletes, nil
}
Exemplo n.º 2
0
func doPrepared(endpoint *HttpEndpoint, w http.ResponseWriter, req *http.Request) (interface{}, errors.Error) {
	vars := mux.Vars(req)
	name := vars["name"]

	switch req.Method {
	case "DELETE":
		err := plan.DeletePrepared(name)
		if err != nil {
			return nil, err
		}
		return true, nil
	case "GET":
		return plan.GetPrepared(value.NewValue(name))
	default:
		return nil, nil
	}
}