Remove non-documentation lint

Because of extensive nature of changes, tested all three non-memstore
backends - passed.
This commit is contained in:
kortschak 2014-08-28 11:51:39 +09:30
parent 6614466d23
commit 484bf145a8
35 changed files with 277 additions and 284 deletions

View file

@ -29,7 +29,7 @@ import (
"github.com/google/cayley/quad/cquads"
)
func ParseJsonToQuadList(jsonBody []byte) ([]quad.Quad, error) {
func ParseJSONToQuadList(jsonBody []byte) ([]quad.Quad, error) {
var quads []quad.Quad
err := json.Unmarshal(jsonBody, &quads)
if err != nil {
@ -37,38 +37,38 @@ func ParseJsonToQuadList(jsonBody []byte) ([]quad.Quad, error) {
}
for i, q := range quads {
if !q.IsValid() {
return nil, fmt.Errorf("Invalid quad at index %d. %s", i, q)
return nil, fmt.Errorf("invalid quad at index %d. %s", i, q)
}
}
return quads, nil
}
func (api *Api) ServeV1Write(w http.ResponseWriter, r *http.Request, _ httprouter.Params) int {
func (api *API) ServeV1Write(w http.ResponseWriter, r *http.Request, _ httprouter.Params) int {
if api.config.ReadOnly {
return FormatJson400(w, "Database is read-only.")
return jsonResponse(w, 400, "Database is read-only.")
}
bodyBytes, err := ioutil.ReadAll(r.Body)
if err != nil {
return FormatJson400(w, err)
return jsonResponse(w, 400, err)
}
quads, err := ParseJsonToQuadList(bodyBytes)
quads, err := ParseJSONToQuadList(bodyBytes)
if err != nil {
return FormatJson400(w, err)
return jsonResponse(w, 400, err)
}
api.handle.QuadWriter.AddQuadSet(quads)
fmt.Fprintf(w, "{\"result\": \"Successfully wrote %d quads.\"}", len(quads))
return 200
}
func (api *Api) ServeV1WriteNQuad(w http.ResponseWriter, r *http.Request, params httprouter.Params) int {
func (api *API) ServeV1WriteNQuad(w http.ResponseWriter, r *http.Request, params httprouter.Params) int {
if api.config.ReadOnly {
return FormatJson400(w, "Database is read-only.")
return jsonResponse(w, 400, "Database is read-only.")
}
formFile, _, err := r.FormFile("NQuadFile")
if err != nil {
glog.Errorln(err)
return FormatJsonError(w, 500, "Couldn't read file: "+err.Error())
return jsonResponse(w, 500, "Couldn't read file: "+err.Error())
}
defer formFile.Close()
@ -108,17 +108,17 @@ func (api *Api) ServeV1WriteNQuad(w http.ResponseWriter, r *http.Request, params
return 200
}
func (api *Api) ServeV1Delete(w http.ResponseWriter, r *http.Request, params httprouter.Params) int {
func (api *API) ServeV1Delete(w http.ResponseWriter, r *http.Request, params httprouter.Params) int {
if api.config.ReadOnly {
return FormatJson400(w, "Database is read-only.")
return jsonResponse(w, 400, "Database is read-only.")
}
bodyBytes, err := ioutil.ReadAll(r.Body)
if err != nil {
return FormatJson400(w, err)
return jsonResponse(w, 400, err)
}
quads, err := ParseJsonToQuadList(bodyBytes)
quads, err := ParseJSONToQuadList(bodyBytes)
if err != nil {
return FormatJson400(w, err)
return jsonResponse(w, 400, err)
}
count := 0
for _, q := range quads {