Skip to content

radioinmyhead/csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

csv

parse csv to gostruct

package main

import (
        "fmt"

        "github.com/radioinmyhead/csv"
)

type Base struct {
        Id int
}

type Animal struct {
        Base  `csv:"extends"`
        Name  string
        Order string
}

var data = `id,name,order
#uuid,#name,#xxxx
12,Platypus,Monotremata
34,Quoll,Dasyuromorphia`

func main() {
        var ret []Animal // or []*Animal
        err := csv.ReadString(data, &ret)
        fmt.Println(ret, err)
}

About

parse csv to gostruct

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages