MCPcopy Create free account
hub / github.com/rilldata/rill / parseExportFormat

Function parseExportFormat

runtime/parser/parse_report.go:283–299  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

281}
282
283func parseExportFormat(s string) (runtimev1.ExportFormat, error) {
284 switch strings.ToLower(s) {
285 case "":
286 return runtimev1.ExportFormat_EXPORT_FORMAT_UNSPECIFIED, nil
287 case "csv":
288 return runtimev1.ExportFormat_EXPORT_FORMAT_CSV, nil
289 case "xlsx":
290 return runtimev1.ExportFormat_EXPORT_FORMAT_XLSX, nil
291 case "parquet":
292 return runtimev1.ExportFormat_EXPORT_FORMAT_PARQUET, nil
293 default:
294 if val, ok := runtimev1.ExportFormat_value[s]; ok {
295 return runtimev1.ExportFormat(val), nil
296 }
297 return runtimev1.ExportFormat_EXPORT_FORMAT_UNSPECIFIED, fmt.Errorf("invalid export format %q", s)
298 }
299}

Callers 1

parseReportMethod · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected