Cscott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/96549


Change subject: Sync to version of db.js in mw-latexer.
......................................................................

Sync to version of db.js in mw-latexer.

Change-Id: I3087559b432a6986f65080cd1e717c5b05f74581
---
M lib/db.js
1 file changed, 12 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Collection/OfflineContentGenerator/bundler
 refs/changes/49/96549/1

diff --git a/lib/db.js b/lib/db.js
index 0238c58..fc044b8 100644
--- a/lib/db.js
+++ b/lib/db.js
@@ -36,6 +36,18 @@
        });
 };
 
+// Returns a promise which will be resolved (with the number of keys)
+// when the iteration is complete
+Db.prototype.forEach = function(f, nojson) {
+       var each = function(err, row) {
+               var val = nojson ? row.val : JSON.parse(row.val);
+               f(row.key, val);
+       };
+       return this.db.then(function(db) {
+               return nodefn.call(db.each.bind(db), "SELECT * FROM kv_table;", 
each);
+       });
+};
+
 // Returns a promise to write a value.
 Db.prototype.put = function(key, value) {
        if (typeof(value) !== 'string') { value = JSON.stringify(value); }

-- 
To view, visit https://gerrit.wikimedia.org/r/96549
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3087559b432a6986f65080cd1e717c5b05f74581
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Collection/OfflineContentGenerator/bundler
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to