summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go30
1 files changed, 30 insertions, 0 deletions
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")