diff options
| author | rtz12 <koenig@fagott.pw> | 2016-10-12 20:33:24 (UTC) |
|---|---|---|
| committer | rtz12 <koenig@fagott.pw> | 2016-10-12 20:33:24 (UTC) |
| commit | 6fba92d36432d28e3ad62e6b3da5a3b807011482 (patch) | |
| tree | 6899ce02203466fe4efd079f773650d445aa9a76 /tools/importer/main.go | |
| parent | caa0e61762511c32e45caf0df4e9dca4d4670849 (diff) | |
Mal wieder Jans Suppe ausgeloeffelt
Diffstat (limited to 'tools/importer/main.go')
| -rw-r--r-- | tools/importer/main.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/importer/main.go b/tools/importer/main.go index 8c60ef7..284ef44 100644 --- a/tools/importer/main.go +++ b/tools/importer/main.go | |||
| @@ -8,8 +8,7 @@ import ( | |||
| 8 | "path/filepath" | 8 | "path/filepath" |
| 9 | 9 | ||
| 10 | "fagott.pw/grilist/grilist" | 10 | "fagott.pw/grilist/grilist" |
| 11 | "fagott.pw/grilist/modules/grils" | 11 | "fagott.pw/grilist/models" |
| 12 | "fagott.pw/grilist/modules/tags" | ||
| 13 | 12 | ||
| 14 | _ "github.com/lib/pq" | 13 | _ "github.com/lib/pq" |
| 15 | ) | 14 | ) |
| @@ -22,7 +21,7 @@ var db *sql.DB | |||
| 22 | var r GrilReader | 21 | var r GrilReader |
| 23 | 22 | ||
| 24 | type WrappedGril struct { | 23 | type WrappedGril struct { |
| 25 | Gril grils.Gril | 24 | Gril models.Gril |
| 26 | Image string | 25 | Image string |
| 27 | Thumb string | 26 | Thumb string |
| 28 | } | 27 | } |
| @@ -113,7 +112,7 @@ func InsertTags(dbID int, g WrappedGril, taglist map[string]int) { | |||
| 113 | } | 112 | } |
| 114 | var id int | 113 | var id int |
| 115 | row := db.QueryRow(`INSERT INTO grilist.tags (name, type) VALUES | 114 | row := db.QueryRow(`INSERT INTO grilist.tags (name, type) VALUES |
| 116 | ($1, $2) RETURNING id;`, v, tags.TagTypeGril) | 115 | ($1, $2) RETURNING id;`, v, models.TagTypeGril) |
| 117 | row.Scan(&id) | 116 | row.Scan(&id) |
| 118 | taglist[v] = id | 117 | taglist[v] = id |
| 119 | fmt.Printf("Inserted tag %s as %d\n", v, id) | 118 | fmt.Printf("Inserted tag %s as %d\n", v, id) |
| @@ -242,7 +241,7 @@ func main() { | |||
| 242 | } | 241 | } |
| 243 | 242 | ||
| 244 | taglist := make(map[string]int) | 243 | taglist := make(map[string]int) |
| 245 | rows, _ := db.Query("SELECT id, name FROM grilist.tags WHERE type = $1;", tags.TagTypeGril) | 244 | rows, _ := db.Query("SELECT id, name FROM grilist.tags WHERE type = $1;", models.TagTypeGril) |
| 246 | for rows.Next() { | 245 | for rows.Next() { |
| 247 | var id int | 246 | var id int |
| 248 | var name string | 247 | var name string |
