MCPcopy Create free account
hub / github.com/cli/cli / lastQuery

Function lastQuery

script/ghmock/set.go:286–297  ·  view source on GitHub ↗

lastQuery returns the query gh most recently sent for a GraphQL request name, or "" if it hasn't sent one.

(st *state, name string)

Source from the content-addressed store, hash-verified

284// lastQuery returns the query gh most recently sent for a GraphQL request
285// name, or "" if it hasn't sent one.
286func lastQuery(st *state, name string) (string, error) {
287 entries, err := st.readLog()
288 if err != nil {
289 return "", err
290 }
291 for _, entrie := range slices.Backward(entries) {
292 if entrie.Name == name && entrie.GraphQL != nil {
293 return entrie.GraphQL.Query, nil
294 }
295 }
296 return "", nil
297}
298
299// applySet changes one stored response and returns its position.
300func applySet(responses responseSet, opts setOptions) (int, error) {

Callers 1

schemaCheckFunction · 0.85

Calls 1

readLogMethod · 0.80

Tested by

no test coverage detected