fdboost
Version:
Performance enhanced utilities for FoundationDB
14 lines (12 loc) • 413 B
text/coffeescript
module.exports = (fdb) ->
enhancements =
packEncoded: (arr, prefix) ->
encodedArr = (fdb.encoding.encode(item, prefix) for item in arr)
@pack(encodedArr)
unpackEncoded: (key, prefix) ->
encodedArr = @unpack(key)
(fdb.encoding.decode(item, prefix) for item in encodedArr)
for fnName, fn of enhancements
fdb.tuple[fnName] = fn
fdb.Subspace::[fnName] = fn
fdb.DirectoryLayer::[fnName] = fn