use the ContinuousQuery structure instead of an interface

pull/370/head
John Shahid 2014-03-28 13:00:19 -04:00
parent 21f089d334
commit c8f88c5bb5
1 changed files with 5 additions and 4 deletions

View File

@ -865,15 +865,16 @@ func (self *HttpServer) createDbContinuousQueries(w libhttp.ResponseWriter, r *l
db := r.URL.Query().Get(":db") db := r.URL.Query().Get(":db")
self.tryAsDbUserAndClusterAdmin(w, r, func(u User) (int, interface{}) { self.tryAsDbUserAndClusterAdmin(w, r, func(u User) (int, interface{}) {
var values interface{}
body, err := ioutil.ReadAll(r.Body) body, err := ioutil.ReadAll(r.Body)
if err != nil { if err != nil {
return libhttp.StatusInternalServerError, err.Error() return libhttp.StatusInternalServerError, err.Error()
} }
json.Unmarshal(body, &values)
query := values.(map[string]interface{})["query"].(string)
if err := self.coordinator.CreateContinuousQuery(u, db, query); err != nil { // note: id isn't used when creating a new continuous query
values := &ContinuousQuery{}
json.Unmarshal(body, values)
if err := self.coordinator.CreateContinuousQuery(u, db, values.Query); err != nil {
return errorToStatusCode(err), err.Error() return errorToStatusCode(err), err.Error()
} }
return libhttp.StatusOK, nil return libhttp.StatusOK, nil