MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / parseAndStoreData

Function parseAndStoreData

internal/files/files.go:130–139  ·  view source on GitHub ↗
(ctx context.Context, uploadID, source string, reader io.Reader, fileType string, store StoreFunc)

Source from the content-addressed store, hash-verified

128}
129
130func 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
141func createTempFile(originalFilename string) (*os.File, error) {
142 tempDir := filepath.Join(os.TempDir(), "ledgerforge_uploads")

Callers 1

UploadExternalDataFunction · 0.85

Calls 2

ProcessCSVFunction · 0.85
ProcessJSONFunction · 0.85

Tested by

no test coverage detected