Created
February 4, 2017 23:40
-
-
Save gmaclennan/39ed55d619bf57cd0cc29a6c210f515b to your computer and use it in GitHub Desktop.
Patch for hyperkv 2.0.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/index.js b/index.js | |
index 79f78e4..e9897c0 100644 | |
--- a/index.js | |
+++ b/index.js | |
@@ -101,7 +101,8 @@ KV.prototype.del = function (key, opts, cb) { | |
} | |
if (!opts) opts = {} | |
if (!cb) cb = noop | |
- self._put(key, { d: key }, opts, function (err, node) { | |
+ var value = xtend(opts.fields || {}, { k: key, d: true, v: opts.value }) | |
+ self._put(key, value, opts, function (err, node) { | |
cb(err, node) | |
if (!err) self.emit('del', key, node) | |
}) | |
@@ -264,7 +265,7 @@ KV.prototype.batch = function (rows, opts, cb) { | |
}) | |
} else if (row.type === 'del') { | |
batch.push({ | |
- value: xtend(row.fields || {}, { d: row.key }), | |
+ value: xtend(row.fields || {}, { k: row.key, d: true, v: row.value }), | |
links: row.links | |
}) | |
} else if (row.type) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment