Skip to content
Snippets Groups Projects
Unverified Commit ecbd269e authored by Pawan Rawal's avatar Pawan Rawal
Browse files

Adding suppirt for mutations in goclient

parent a5a8a126
No related branches found
No related tags found
No related merge requests found
......@@ -226,12 +226,24 @@ func (s *server) Query(ctx context.Context,
// TODO(pawan): Refactor query parsing and graph processing code to a common
// function used by Query and queryHandler
glog.WithField("q", req.Query).Debug("Query received.")
gq, _, err := gql.Parse(req.Query)
gq, mu, err := gql.Parse(req.Query)
if err != nil {
x.Err(glog, err).Error("While parsing query")
return resp, err
}
// If we have mutations, run them first.
if mu != nil && len(mu.Set) > 0 {
if err = mutationHandler(mu); err != nil {
glog.WithError(err).Error("While handling mutations.")
return resp, err
}
}
if gq == nil || (gq.UID == 0 && len(gq.XID) == 0) {
return resp, err
}
sg, err := query.ToSubGraph(gq)
if err != nil {
x.Err(glog, err).Error("While conversion to internal format")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment