MCPcopy Index your code
hub / github.com/github/github-mcp-server / csvDocument

Function csvDocument

pkg/github/csv_output.go:155–170  ·  view source on GitHub ↗
(value any)

Source from the content-addressed store, hash-verified

153}
154
155func csvDocument(value any) csvOutputDocument {
156 switch v := value.(type) {
157 case []any:
158 return csvOutputDocument{rows: csvRowsFromArray(v)}
159 case map[string]any:
160 if rows, metadata, ok := primaryRowsFromMap(v); ok {
161 return csvOutputDocument{
162 metadata: newFlattenedCSVRow(metadata),
163 rows: csvRowsFromArray(rows),
164 }
165 }
166 return csvOutputDocument{rows: []map[string]string{newFlattenedCSVRow(v)}}
167 default:
168 return csvOutputDocument{rows: []map[string]string{scalarCSVRow(v)}}
169 }
170}
171
172func primaryRowsFromMap(value map[string]any) ([]any, map[string]any, bool) {
173 if rows, path, ok := primaryRowsAtCurrentLevel(value); ok {

Callers 1

jsonTextToCSVFunction · 0.85

Calls 4

csvRowsFromArrayFunction · 0.85
primaryRowsFromMapFunction · 0.85
newFlattenedCSVRowFunction · 0.85
scalarCSVRowFunction · 0.85

Tested by

no test coverage detected