From 543ebae42be1b7385e476a4699a7f88e95a2d120 Mon Sep 17 00:00:00 2001 From: horus_arch Date: Mon, 5 Feb 2018 00:13:47 +0100 Subject: Adds dependency on sqlx, viper and logrus. --- main.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'main.go') diff --git a/main.go b/main.go index ce63d37..94f1e3a 100644 --- a/main.go +++ b/main.go @@ -4,8 +4,19 @@ import ( "encoding/json" "fmt" "log" + + _ "database/sql" + _ "github.com/go-sql-driver/mysql" + "github.com/jmoiron/sqlx" ) +type App struct { + Offers []Angebot + Shops []Shop + Config *Config + DB *sqlx.DB +} + type Angebot struct { Name string Shop string @@ -17,8 +28,27 @@ type Angebot struct { Valid_until string } +type Shop struct { + Name string + Url string + Logo_url string + Shipping_costs int + Free_shipping string +} + func main() { + var err error + + app := App{Config: &Config{}} + app.Config.parseConfig("") + + // Hard coded mysql driver. + app.DB, err = sqlx.Connect("mysql", app.Config.DBUser+":"+app.Config.DBPassword+"@"+app.Config.DBHost+"/"+app.Config.DBDBName+app.Config.DBOptions) + if err != nil { + log.Fatal(err) + } + W := ScrapeBottleWord() printName(W, "BottleWorld") -- cgit v1.2.3