MCPcopy Index your code
hub / github.com/cli/cli / generatePullRequestNodeID

Function generatePullRequestNodeID

pkg/cmd/agent-task/capi/sessions.go:542–556  ·  view source on GitHub ↗

generatePullRequestNodeID converts an int64 databaseID and repoID to a GraphQL Node ID format with the "PR_" prefix for pull requests

(repoID, pullRequestID int64)

Source from the content-addressed store, hash-verified

540// generatePullRequestNodeID converts an int64 databaseID and repoID to a GraphQL Node ID format
541// with the "PR_" prefix for pull requests
542func generatePullRequestNodeID(repoID, pullRequestID int64) string {
543 buf := bytes.Buffer{}
544 parts := []int64{0, repoID, pullRequestID}
545
546 encoder := msgpack.NewEncoder(&buf)
547 encoder.UseCompactInts(true)
548
549 if err := encoder.Encode(parts); err != nil {
550 panic(err)
551 }
552
553 encoded := base64.RawURLEncoding.EncodeToString(buf.Bytes())
554
555 return "PR_" + encoded
556}
557
558func generateUserNodeID(userID int64) string {
559 buf := bytes.Buffer{}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected