-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_update_db.go
61 lines (45 loc) · 1.16 KB
/
test_update_db.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package main
import (
"imfdb"
_ "googlesearch"
"fmt"
)
const (
API_KEY = "AIzaSyBdKG_M0zZ3BAv5NTyjXoo9015D-svGs0o"
SEARCH_ENGINE = "014331277232571370493:akt9l5xjkye"
)
func check(err error) {
if err != nil {
panic(err)
}
}
func main() {
db := &imfdb.ImfDB {}
err := db.Init(imfdb.Config {
UserName : "admin",
Password : "11235813",
Addr : "insa-vn.cluqt19clm04.eu-west-2.rds.amazonaws.com:3306",
DBName : "ImagesFight",
})
check(err)
defer db.Close()
// searcher, err := googlesearch.New(API_KEY, SEARCH_ENGINE, true)
// check(err)
// var imgLinks []imfdb.CharacterImg
// results, err := searcher.Search("Jon Snow", 10, 1)
// check(err)
// for _, item := range(results.Items) {
// imgLinks = append(imgLinks, imfdb.CharacterImg { Url: item.Link, Character: "Jon Snow" })
// }
// err = db.AddImgUrls(imgLinks)
// check(err)
// results, err = searcher.Search("Tyrion", 10, 1)
// check(err)
// imgLinks = nil
// for _, item := range(results.Items) {
// imgLinks = append(imgLinks, imfdb.CharacterImg { Url: item.Link, Character: "Tyrion" })
// }
// err = db.AddImgUrls(imgLinks)
// check(err)
fmt.Println("Hello")
}