-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDatabaseQuery.go
More file actions
39 lines (37 loc) · 974 Bytes
/
DatabaseQuery.go
File metadata and controls
39 lines (37 loc) · 974 Bytes
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
package main
import (
"fmt"
"github.com/astaxie/beego/orm"
)
var O orm.Ormer
func init(){
orm.RegisterDataBase("default", "mysql", "root:116118@tcp(www.whatdoyoudo.club:3306)/dataset?charset=utf8", 30)
// create table
orm.RegisterModel(new(ModelInit))
orm.RunSyncdb("default", false, true)
O=orm.NewOrm()
}
func GroupImageIDGet(Group string)[]orm.ParamsList{
var res []orm.ParamsList
_,err:=O.Raw("select distinct imageID from imageLabelTable where labelName = ? and confidence=1 limit 10;",Group).ValuesList(&res)
if err != nil {
fmt.Println(err)
}
return res
}
type UrlType struct {
ImageID string
Url string
}
func GroupUrlGet(GroupList []orm.ParamsList){
var res orm.ParamsList
fmt.Printf("%#v",len(GroupList))
for i:=0;i<len(GroupList);i++{
fmt.Printf("%s",GroupList[i][0])
_,err:=O.Raw("select urlLink from urlTable where imageID=?",GroupList[i][0]).ValuesFlat(&res)
if err != nil {
fmt.Printf("%#v",err)
}
fmt.Printf("%#v",res)
}
}