generatePullRequestNodeID converts an int64 databaseID and repoID to a GraphQL Node ID format with the "PR_" prefix for pull requests
(repoID, pullRequestID int64)
| 549 | // generatePullRequestNodeID converts an int64 databaseID and repoID to a GraphQL Node ID format |
| 550 | // with the "PR_" prefix for pull requests |
| 551 | func generatePullRequestNodeID(repoID, pullRequestID int64) string { |
| 552 | buf := bytes.Buffer{} |
| 553 | parts := []int64{0, repoID, pullRequestID} |
| 554 | |
| 555 | encoder := msgpack.NewEncoder(&buf) |
| 556 | encoder.UseCompactInts(true) |
| 557 | |
| 558 | if err := encoder.Encode(parts); err != nil { |
| 559 | panic(err) |
| 560 | } |
| 561 | |
| 562 | encoded := base64.RawURLEncoding.EncodeToString(buf.Bytes()) |
| 563 | |
| 564 | return "PR_" + encoded |
| 565 | } |
| 566 | |
| 567 | func generateUserNodeID(userID int64) string { |
| 568 | buf := bytes.Buffer{} |
no outgoing calls
no test coverage detected