(ctx context.Context, uploadID, source string, reader io.Reader, fileType string, store StoreFunc)
| 128 | } |
| 129 | |
| 130 | func parseAndStoreData(ctx context.Context, uploadID, source string, reader io.Reader, fileType string, store StoreFunc) (int, error) { |
| 131 | switch fileType { |
| 132 | case "text/csv", "text/csv; charset=utf-8": |
| 133 | return ProcessCSV(ctx, uploadID, source, reader, store) |
| 134 | case "application/json": |
| 135 | return ProcessJSON(ctx, uploadID, source, reader, store) |
| 136 | default: |
| 137 | return 0, fmt.Errorf("unsupported file type: %s", fileType) |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | func createTempFile(originalFilename string) (*os.File, error) { |
| 142 | tempDir := filepath.Join(os.TempDir(), "ledgerforge_uploads") |
no test coverage detected