本文整理匯總了Golang中github.com/qgweb/new/lib/mongodb.MongodbQueryConf.Select方法的典型用法代碼示例。如果您正苦於以下問題:Golang MongodbQueryConf.Select方法的具體用法?Golang MongodbQueryConf.Select怎麽用?Golang MongodbQueryConf.Select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/qgweb/new/lib/mongodb.MongodbQueryConf
的用法示例。
在下文中一共展示了MongodbQueryConf.Select方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: getBigCat
func (this *UserTrack) getBigCat() {
conf := mongodb.MongodbQueryConf{}
conf.Db = "data_source"
conf.Table = "taocat"
conf.Query = mongodb.MM{"type": "0"}
conf.Select = mongodb.MM{"bid": 1, "cid": 1}
this.mg.Query(conf, func(info map[string]interface{}) {
this.bigCategoryMap[convert.ToString(info["cid"])] = convert.ToString(info["bid"])
})
}
示例2: initCategory
func (this *TaobaoESStore) initCategory() {
q := mongodb.MongodbQueryConf{}
q.Db = "xu_precise"
q.Table = "taocat"
q.Select = mongodb.MM{"name": 1, "cid": 1, "_id": 0}
q.Query = mongodb.MM{"type": "0"}
this.catMap = make(map[string]string)
this.store.Query(q, func(info map[string]interface{}) {
this.catMap[info["cid"].(string)] = info["name"].(string)
})
}
示例3: getGeop
func getGeop(w http.ResponseWriter, r *http.Request) {
ad := strings.TrimSpace(r.URL.Query().Get("ad"))
mlink, err := db.Get()
lon := ""
lat := ""
if err != nil {
log.Error(err)
w.Write([]byte(""))
return
}
defer mlink.Close()
if ad == "" {
w.WriteHeader(404)
w.Write([]byte(""))
return
}
qconf := mongodb.MongodbQueryConf{}
qconf.Db = "lonlat_data"
qconf.Table = "tbl_map"
qconf.Select = mongodb.MM{"lon": 1, "lat": 1}
qconf.Query = mongodb.MM{"ad": ad}
info, err := mlink.One(qconf)
if err != nil {
log.Error(err)
w.Write([]byte(""))
return
}
if v, ok := info["lon"]; ok {
lon = convert.ToString(v)
}
if v, ok := info["lat"]; ok {
lat = convert.ToString(v)
}
w.Write([]byte(fmt.Sprintf("%s,%s", lon, lat)))
}