Skip to content

Commit

Permalink
feat: examples
Browse files Browse the repository at this point in the history
  • Loading branch information
shigetaichi committed Oct 5, 2023
1 parent dc7f697 commit 4591907
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,21 @@ func main() {
if err != nil {
panic(err)
}

// Read to struct slice
clientsFile2, err := os.Open("clients.csv")
if err != nil {
panic(err)
}

var readClients []*Client
xsvRead := xsv.NewXsvRead[*Client]()
xsvRead.From = 2
xsvRead.To = 4
if err := xsvRead.SetFileReader(clientsFile2).ReadTo(&readClients); err != nil {
panic(err)
}
for _, readClient := range readClients {
fmt.Println(*readClient)
}
}

0 comments on commit 4591907

Please sign in to comment.