encoding/csv into struct?

327 views
Skip to first unread message

Kyle Wolfe

unread,
Nov 6, 2013, 4:38:35 PM11/6/13
to golan...@googlegroups.com
I've got the reader going correctly, each row is returning a slice of strings. How can I easily take this slice create a variable based on a struct (which will have other type other than string, such as int). Do I have to manually loop through and convert everything?

Javier Asensio

unread,
Nov 6, 2013, 6:51:57 PM11/6/13
to Kyle Wolfe, golang-nuts
have a look into http://github.com/bmatsuo/csvutil they have that part implemented.

Here a snippet how to use it
http://play.golang.org/p/k19CbMoOeU

cheers,

Javi


On Wed, Nov 6, 2013 at 9:38 PM, Kyle Wolfe <kyle.a...@gmail.com> wrote:
I've got the reader going correctly, each row is returning a slice of strings. How can I easily take this slice create a variable based on a struct (which will have other type other than string, such as int). Do I have to manually loop through and convert everything?

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages