| 687 | } |
| 688 | |
| 689 | func (hc *HTTPClient) Mutate(mutation string, commitNow bool) ([]byte, error) { |
| 690 | url := hc.dqlMutateUrl |
| 691 | if commitNow { |
| 692 | url = hc.dqlMutateUrl + "?commitNow=true" |
| 693 | } |
| 694 | |
| 695 | req, err := http.NewRequest(http.MethodPost, url, bytes.NewBufferString(mutation)) |
| 696 | if err != nil { |
| 697 | return nil, errors.Wrapf(err, "error building req for endpoint [%v]", url) |
| 698 | } |
| 699 | req.Header.Add("Content-Type", "application/rdf") |
| 700 | if hc.HttpToken != nil { |
| 701 | req.Header.Add("X-Dgraph-AccessToken", hc.AccessJwt) |
| 702 | } |
| 703 | return DoReq(req) |
| 704 | } |
| 705 | |
| 706 | func (hc *HTTPClient) MoveTablet(predicate string, group uint32) error { |
| 707 | url := fmt.Sprintf("%s?tablet=%s&group=%d", hc.moveTabletURL, predicate, group) |