MCPcopy Index your code
hub / github.com/google/go-github / decodeNDJSONMetrics

Function decodeNDJSONMetrics

github/copilot.go:1163–1177  ·  view source on GitHub ↗

decodeNDJSONMetrics streams a newline-delimited JSON response body into a slice of *T, returning a nil slice when the body is empty.

(r io.Reader)

Source from the content-addressed store, hash-verified

1161// decodeNDJSONMetrics streams a newline-delimited JSON response body into a slice of *T,
1162// returning a nil slice when the body is empty.
1163func decodeNDJSONMetrics[T any](r io.Reader) ([]*T, error) {
1164 var records []*T
1165 dec := json.NewDecoder(r)
1166 for {
1167 var rec *T
1168 if err := dec.Decode(&rec); err != nil {
1169 if errors.Is(err, io.EOF) {
1170 break
1171 }
1172 return nil, err
1173 }
1174 records = append(records, rec)
1175 }
1176 return records, nil
1177}
1178
1179// DownloadDailyMetrics downloads the payload of a 1-day Copilot usage metrics report from a
1180// download link returned by GetEnterpriseDailyMetricsReport or GetOrganizationDailyMetricsReport.

Callers

nothing calls this directly

Calls 1

IsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…