فهرست منبع

增加mongodb的upser插入文清

renzheng 8 سال پیش
والد
کامیت
af5d1ac25f

+ 14 - 0
common/src/github.com/PuerkitoBio/goquery/property.go

@@ -99,6 +99,20 @@ func (s *Selection) Html() (ret string, e error) {
 	return
 }
 
+func (s *Selection) OuterHtml() (ret string, e error) {
+	// Since there is no .innerHtml, the HTML content must be re-created from
+	// the nodes using html.Render.
+	var buf bytes.Buffer
+	if len(s.Nodes) > 0 {
+		e = html.Render(&buf, s.Nodes[0])
+		if e != nil {
+			return
+		}
+		ret = buf.String()
+	}
+	return
+}
+
 // AddClass adds the given class(es) to each element in the set of matched elements.
 // Multiple class names can be specified, separated by a space or via multiple arguments.
 func (s *Selection) AddClass(class ...string) *Selection {

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1 - 0
common/src/qfw/util/encrypt_test.go


+ 25 - 0
common/src/qfw/util/mongodb/mongodbSim.go

@@ -149,6 +149,31 @@ func (m *MongodbSim) UpdateBulk(c string, doc ...[]map[string]interface{}) bool
 	return b
 }
 
+//批量更新
+func (m *MongodbSim) UpSertBulk(c string, doc ...[]map[string]interface{}) bool {
+	defer util.Catch()
+	sess := m.GetMgoConn()
+	b := true
+	if sess != nil {
+		defer m.DestoryMongoConn(sess)
+		coll := sess.DB(m.DbName).C(c)
+		bulk := coll.Bulk()
+		for _, v := range doc {
+			if len(v) == 2 {
+				bulk.Upsert(v[0], v[1])
+			}
+		}
+		_, err := bulk.Run()
+		if nil != err {
+			log.Println("BulkUpsertError", err)
+			b = false
+		}
+	} else {
+		b = false
+	}
+	return b
+}
+
 //批量插入
 func (m *MongodbSim) SaveBulk(c string, doc ...map[string]interface{}) bool {
 	defer util.Catch()

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است