diff options
| author | Nikolaus Gotsche <n@softwarefools.com> | 2018-10-26 15:36:21 +0200 |
|---|---|---|
| committer | Nikolaus Gotsche <n@softwarefools.com> | 2018-10-26 15:36:21 +0200 |
| commit | 3fb09744cc5264fdf3740364a9c6f6f5b64707cc (patch) | |
| tree | ca3a8a716a163783febd1859fe37f9217331a79e /importexport.go | |
| parent | d06db7af6014e8498672899218a05adf36ab1aa3 (diff) | |
Export tested, structs made Public0.3.4
Diffstat (limited to 'importexport.go')
| -rw-r--r-- | importexport.go | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/importexport.go b/importexport.go new file mode 100644 index 0000000..471a022 --- /dev/null +++ b/importexport.go @@ -0,0 +1,44 @@ +package main + +import ( + "os" + "github.com/atotto/encoding/csv" + //"bufio" + //"encoding/csv" +) + +func ExportTasks(in []Task,filename string) { + file ,err := os.Create(filename) + checkErr(err) + defer file.Close() + + w := csv.NewWriter(file) + defer w.Flush() + for _,i := range in { + w.WriteStruct(i) + } +} + +func ExportProjects(in []Project,filename string) { + file ,err := os.Create(filename) + checkErr(err) + defer file.Close() + + w := csv.NewWriter(file) + defer w.Flush() + for _,i := range in { + w.WriteStruct(i) + } +} + +func ExportCustomers(in []Customer,filename string) { + file ,err := os.Create(filename) + checkErr(err) + defer file.Close() + + w := csv.NewWriter(file) + defer w.Flush() + for _,i := range in { + w.WriteStruct(i) + } +} |
