What is the best way to read large CSV files, at the moment I am reading one record at a time rather than using ReadAll()
.
reader := csv.NewReader(csvFile)
reader.FieldsPerRecord = -1
for {
// read just one record at a time
record, err := reader.Read()
if err == io.EOF {
break
} else if err != nil {
checkErr(err)
return
}
Is there a better way to do this to save memory?
I am writing each record/row to a database by sending an array over GRPC to a separate service.