MCPcopy
hub / github.com/uber/aresdb / AddColumn

Method AddColumn

api/schema_handler.go:210–229  ·  view source on GitHub ↗

AddColumn swagger:route POST /schema/tables/{table}/columns addColumn add a single column to existing table Consumes: - application/json Responses: default: errorResponse 200: noContentResponse

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

208// default: errorResponse
209// 200: noContentResponse
210func (handler *SchemaHandler) AddColumn(w http.ResponseWriter, r *http.Request) {
211 var addColumnRequest AddColumnRequest
212 err := common.ReadRequest(r, &addColumnRequest)
213 if err != nil {
214 common.RespondWithBadRequest(w, err)
215 return
216 }
217
218 err = handler.metaStore.AddColumn(addColumnRequest.TableName, addColumnRequest.Body.Column, addColumnRequest.Body.AddToArchivingSortOrder)
219 // TODO: validate column
220 // might better do in metaStore and here needs to return either user error or server error
221 if err != nil {
222 // TODO: need mapping from metaStore error to api error
223 /// for metaStore error might also be user error
224 common.RespondWithError(w, err)
225 return
226 }
227
228 common.RespondWithJSONObject(w, nil)
229}
230
231// UpdateColumn swagger:route PUT /schema/tables/{table}/columns/{column} updateColumn
232// update specified column

Callers

nothing calls this directly

Calls 1

AddColumnMethod · 0.65

Tested by

no test coverage detected