当前位置: 首页>>代码示例>>Golang>>正文


Golang mongodb.MongodbQueryConf类代码示例

本文整理汇总了Golang中github.com/qgweb/new/lib/mongodb.MongodbQueryConf的典型用法代码示例。如果您正苦于以下问题:Golang MongodbQueryConf类的具体用法?Golang MongodbQueryConf怎么用?Golang MongodbQueryConf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MongodbQueryConf类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: VisitorData

// 域名找回信息获取
func (this *ZjPut) VisitorData(out chan interface{}, in chan int8) {
	var datacount = 0
	defer func() {
		// 统计数据 zhejiang_put , other_1461016800, 11111
		lib.StatisticsData("dsource_stats", "zj_"+this.Timestamp+"_visitor",
			convert.ToString(datacount), "")
	}()
	m, err := lib.GetMongoObj()
	if err != nil {
		log.Error(err)
		in <- 1
		return
	}
	defer m.Close()

	qconf := mongodb.MongodbQueryConf{}
	qconf.Db = "data_source"
	qconf.Table = "zhejiang_visitor"
	qconf.Query = mongodb.MM{}
	m.Query(qconf, func(info map[string]interface{}) {
		ad := convert.ToString(info["ad"])
		ua := encrypt.DefaultMd5.Encode(encrypt.DefaultBase64.Decode(convert.ToString(info["ua"])))
		aids := convert.ToString(info["aids"])
		datacount++
		out <- fmt.Sprintf("%s\t%s\t%s", ad, ua, aids)
	})
	log.Info("访客ok")
	in <- 1
}
开发者ID:qgweb,项目名称:new,代码行数:30,代码来源:zj.go

示例2: otherData

func (this *UserTrack) otherData(out chan interface{}, in chan int8) {
	var (
		eghour = timestamp.GetHourTimestamp(-1)
		bghour = timestamp.GetHourTimestamp(-25)
	)
	conf := mongodb.MongodbQueryConf{}
	conf.Db = "data_source"
	conf.Table = "useraction"
	conf.Query = mongodb.MM{"timestamp": mongodb.MM{"$gte": bghour, "$lte": eghour}, "domainId": "0"}
	this.mg_big.Query(conf, func(info map[string]interface{}) {
		ua := "ua"
		ad := convert.ToString(info["AD"])
		if u, ok := info["UA"]; ok {
			ua = convert.ToString(u)
		}
		cids := make([]string, 0, len(info["tag"].([]interface{})))
		for _, v := range info["tag"].([]interface{}) {
			if tags, ok := v.(map[string]interface{}); ok {
				if strings.TrimSpace(convert.ToString(tags["tagId"])) != "" {
					cids = append(cids, convert.ToString(tags["tagId"]))
				}
			}
		}
		out <- fmt.Sprintf("%s\t%s\t%s", ad, ua, strings.Join(cids, ","))
	})
	in <- 1
}
开发者ID:qgweb,项目名称:new,代码行数:27,代码来源:other.go

示例3: 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"])
	})
}
开发者ID:qgweb,项目名称:new,代码行数:10,代码来源:other.go

示例4: cleanPutTable

func (this *Domain) cleanPutTable() {
	qconf := mongodb.MongodbQueryConf{}
	qconf.Db = "data_source"
	qconf.Table = "urltrack_put"
	qconf.Index = []string{"cids.id"}
	this.mg.Drop(qconf)
	this.mg.Create(qconf)
	this.mg.EnsureIndex(qconf)
	qconf.Index = []string{"adua"}
	this.mg.EnsureIndex(qconf)
}
开发者ID:qgweb,项目名称:new,代码行数:11,代码来源:url.go

示例5: 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)
	})
}
开发者ID:qgweb,项目名称:new,代码行数:11,代码来源:tbstore_es.go

示例6: 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)))
}
开发者ID:qgweb,项目名称:new,代码行数:40,代码来源:ad-geo.go

示例7: cleanPutTable

func (this *UserTrack) cleanPutTable() {
	qconf := mongodb.MongodbQueryConf{}
	qconf.Db = "data_source"
	qconf.Table = "useraction_put"
	qconf.Index = []string{"tag.tagId"}
	this.mg.Drop(qconf)
	this.mg.Create(qconf)
	this.mg.EnsureIndex(qconf)
	qconf.Index = []string{"adua"}
	this.mg.EnsureIndex(qconf)
	qconf.Index = []string{"AD"}
	this.mg.EnsureIndex(qconf)

	qconf = mongodb.MongodbQueryConf{}
	qconf.Db = "data_source"
	qconf.Table = "useraction_put_big"
	qconf.Index = []string{"tag.tagId"}
	this.mg_big.Drop(qconf)
	this.mg_big.Create(qconf)
	this.mg_big.EnsureIndex(qconf)
	qconf.Index = []string{"adua"}
	this.mg_big.EnsureIndex(qconf)
	qconf.Index = []string{"AD"}
	this.mg_big.EnsureIndex(qconf)
}
开发者ID:qgweb,项目名称:new,代码行数:25,代码来源:other.go


注:本文中的github.com/qgweb/new/lib/mongodb.MongodbQueryConf类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。