summaryrefslogtreecommitdiff
path: root/importexport.go
diff options
context:
space:
mode:
authorNikolaus Gotsche <n@softwarefools.com>2018-10-26 15:36:21 +0200
committerNikolaus Gotsche <n@softwarefools.com>2018-10-26 15:36:21 +0200
commit3fb09744cc5264fdf3740364a9c6f6f5b64707cc (patch)
treeca3a8a716a163783febd1859fe37f9217331a79e /importexport.go
parentd06db7af6014e8498672899218a05adf36ab1aa3 (diff)
Export tested, structs made Public0.3.4
Diffstat (limited to 'importexport.go')
-rw-r--r--importexport.go44
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)
+ }
+}