diff options
Diffstat (limited to '')
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | cmd/main.go | 80 | ||||
-rw-r--r-- | pkg/db/setup_test.go | 27 |
3 files changed, 1 insertions, 107 deletions
@@ -2,3 +2,4 @@ .idea/* reader/testdata/test.db go.sum +cmd/datamaps diff --git a/cmd/main.go b/cmd/main.go index 1f6e4ab..da801b7 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -49,16 +49,6 @@ func setUp() (string, error) { return dir, nil } -// from datamaps-c - -// { 0,0,0,0, "Datamap options: (when calling 'datamaps datamap')." }, -// {"import", DM_IMPORT, "PATH", 0, "PATH to datamap file to import."}, -// {"name", DM_NAME, "NAME", 0, "The name you want to give to the imported datamap."}, -// {"overwrite", DM_OVERWRITE, 0, 0, "Start fresh with this datamap (erases existing datamap data)."}, -// {"initial", DM_INITIAL, 0, 0, "This option must be used where no datamap table yet exists."}, - -// Checkout https://gobyexample.com/command-line-subcommands - func main() { // setup command setupCmd := flag.NewFlagSet("setup", flag.ExitOnError) @@ -118,73 +108,3 @@ func main() { os.Exit(1) } } - -// var setup bool - -// // Example for go docs about how to set up short and long flags. -// const setupUsage = "Initialise configuration and database files" - -// flag.BoolVar(&setup, "setup", false, setupUsage) -// flag.BoolVar(&setup, "s", false, setupUsage) -// flag.Parse() -// if setup == true { -// _, err := setUp() -// if err != nil { -// log.Fatal(err) -// } -// } else { -// fmt.Println("No command given.") -// flag.PrintDefaults() -// } - -// func main() { -// app := &cli.App{ -// Flags: []cli.Flag{ -// &cli.StringFlag{ -// Name: "datamap, dm", -// Aliases: []string{"dm"}, -// Value: "/home/lemon/Documents/datamaps/input/datamap.csv", -// Usage: "Path to a datamap file", -// }, -// &cli.StringFlag{ -// Name: "master, m", -// Aliases: []string{"m"}, -// Value: "/home/lemon/Documents/datamaps/input/master.xlsx", -// Usage: "Path to a master file", -// }, -// }, -// Commands: []*cli.Command{ -// { -// Name: "import", -// Aliases: []string{"i"}, -// Usage: "Import a bunch of populated templates", -// Action: func(c *cli.Context) error { -// return nil -// }, -// }, -// { -// Name: "export", -// Aliases: []string{"e"}, -// Usage: "Export a master to populate blank templates", -// Action: func(c *cli.Context) error { -// return nil -// }, -// }, -// }, -// Name: "datamaps", -// Usage: "Import and export data to and from spreadsheets", -// Action: func(c *cli.Context) error { -// fmt.Println("DATAMAPS") -// return nil -// }, -// } - -// err := app.Run(os.Args) -// if err != nil { -// log.Fatal(err) -// } -// _, err = setUp() -// if err != nil { -// log.Fatal(err) -// } -// } diff --git a/pkg/db/setup_test.go b/pkg/db/setup_test.go index a8868ed..b3231fc 100644 --- a/pkg/db/setup_test.go +++ b/pkg/db/setup_test.go @@ -31,34 +31,7 @@ func TestOpenSQLiteFile(t *testing.T) { } } -// TODO: -// THIS IS WHAT I WANT TO DO WITH A TRANNY -// https://github.com/mattn/go-sqlite3/blob/master/_example/simple/simple.go -// In the production code of course. - -// tx, err := db.Begin() -// if err != nil { -// log.Fatal(err) -// } -// stmt, err := tx.Prepare("insert into foo(id, name) values(?, ?)") -// if err != nil { -// log.Fatal(err) -// } -// defer stmt.Close() -// for i := 0; i < 100; i++ { -// _, err = stmt.Exec(i, fmt.Sprintf("こんにちわ世界%03d", i)) -// if err != nil { -// log.Fatal(err) -// } -// } -// tx.Commit() - func TestDatamapGoesIntoDB(t *testing.T) { - // db, err := SetupDB("./testdata/test.db") // we set up, then just open it. - // defer db.Close() - // if err != nil { - // t.Fatal("Expected to be able to set up the database.") - // } d, err := reader.ReadDML("./testdata/datamap.csv") if err != nil { t.Fatal(err) |