1.0.4
Installable via npm install --save interface-datastore
, it can also be used directly in the browser.
The source is available for download from GitHub. Alternatively, you can install using npm:
$ npm install --save interface-datastore
You can then require()
interface-datastore as normal:
const interfaceDatastore = require('interface-datastore')
interface-datastore
should work in any ECMAScript 2018 environment out of the box.
Usage:
<script type="text/javascript" src="index.js"></script>
The portable versions of interface-datastore
, including index.js
and index.min.js
, are included in the /dist
folder. interface-datastore
can also be found on unpkg.com under
A Key represents the unique identifier of an object. Our Key scheme is inspired by file systems and Google App Engine key model. Keys are meant to be unique across a system. Keys are hierarchical, incorporating more and more specific namespaces. Thus keys can be deemed 'children' or 'ancestors' of other keys:
new Key('/Comedy')
new Key('/Comedy/MontyPython')
Also, every namespace can be parametrized to embed relevant object
information. For example, the Key name
(most specific namespace) could
include the object type:new Key('/Comedy/MontyPython/Actor:JohnCleese')
new Key('/Comedy/MontyPython/Sketch:CheeseShop')
new Key('/Comedy/MontyPython/Sketch:CheeseShop/Character:Mousebender')
(any)
(any)
Cleanup the current key
void
:
Returns wether this key has only one namespace.
bool
:
The first component of a namespace. foo
in foo:bar
(string)
string
:
The last component of a namespace, baz
in foo:bar:baz
.
(string)
string
:
Flatten array of arrays (only one level)
any
:
Store the passed value under the passed key
Promise<void>
:
Store the given key/value pairs
AsyncIterator<{key: Key, value: Buffer}>
:
Retrieve the value for the passed key
Promise<Buffer>
:
Retrieve values for the passed keys
AsyncIterator<Buffer>
:
Check for the existence of a value for the passed key
(Key)
Promise<bool>
:
Remove the record for the passed key
Promise<void>
:
Remove values for the passed keys
AsyncIterator<Key>
:
Create a new batch object.
Object
:
Yield all datastore values
AsyncIterable<{key: Key, value: Buffer}>
:
Query the store.
AsyncIterable<Buffer>
: