Thanks for setting my mind at ease.

On Wednesday, 22 June 2022 at 16:05:17 UTC+1 axel.wa...@googlemail.com 
wrote:

> No, there is no way to do it. You have to make a copy of the slice as you 
> did.
>
> On Wed, Jun 22, 2022 at 4:58 PM Peter Galbavy <pe...@wonderland.org> 
> wrote:
>
>> 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...@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
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/3c20e19d-8805-4f76-b52b-a3b8275ea708n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/d6c39bd9-8f50-4b0e-84e3-71c96f726107n%40googlegroups.com.

Reply via email to