This is probably an FAQ but...

I've tried to understand this before but gave up; I am trying to (quick and 
dirty) import from a CSV or Excel file to a DB and I would like to take the 
slice from csv.Read() and just pass it through to stmt.Exec() but because 
the first is a []string and the second a []interface{} or []any (in 1.18+) 
it baulks. e.g.

  fields, err := csv.Read()
  ... checks
  _, err = stmt.Exec(fields)

I got round it by looping over the slice and putting appending the strings 
to a []interface{} local.

Is there a simpler way to do this inline - please ignore the issues around 
the contents or the number of elements for now.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/3c20e19d-8805-4f76-b52b-a3b8275ea708n%40googlegroups.com.

Reply via email to