diff options
| author | horus_arch | 2018-02-05 00:13:47 +0100 |
|---|---|---|
| committer | horus_arch | 2018-02-05 00:13:47 +0100 |
| commit | 543ebae42be1b7385e476a4699a7f88e95a2d120 (patch) | |
| tree | 492b065baf9fe93326a1e6de36583565b386699f /main.go | |
| parent | 4f7a9316da8e19fa9466ee377148c7d07bf39fd9 (diff) | |
| download | alkobote-543ebae42be1b7385e476a4699a7f88e95a2d120.tar.gz | |
Adds dependency on sqlx, viper and logrus.
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -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") |
