0.4.2 • Published 11 years ago
level1 v0.4.2
level 1 - A simple leveldb wrapper for nodejs
example
var level1 = require('./level1');
level1('ONE.db', function(err, db) {
if (err) { throw err; }
// stores a document
db.set(
{ // document to store
name: 'Afonso Henriques', // no id passed, stores on new id
age: 19
},
function(err, id) { // callback fn
if (err) { throw err; }
console.log(id); // returns the id
}
);
});
level1 instance methods:
get / query
{String} id,
{Function(err, x)} callback
)```
---
```db.getOrUndefined(
{String} id,
{Function(err, x)} callback
)```
---
```db.query(
{Boolean Function(doc, index)} filterFn,
{Function(err, docs)} callback
)```
---
```{Object[]} db.sortPaginate(
{Object[]} docs,
[{Boolean Function(doc1, doc2)} sortFn],
[{Number} docsPerPage],
[{Number} pageNr]
)```
### set (create/update)
```db.set(
{Object} doc,
[{Function(err, x)} callback]
)```
---
```db.setBulk(
{Object[]} docs,
[{Function(err, x)} callback]
)```
---
```db.updateQuery(
{Boolean Function(doc, index)} filterFn,
{Function(doc)} updateFn
?
)```
### delete
```db.del(
{String} id,
[{Function(err, x)} callback]
)```
---
```db.delBulk(
{String[]} arrayOfIds,
[{Function(err, x)} callback]
?
)```
---
```db.delQuery(
{Boolean Function(doc, index)} filterFn,
[{Function(err, x)} callback]
?
)```
0.4.2
11 years ago
0.4.1
11 years ago
0.4.0
11 years ago
0.3.0
11 years ago
0.2.6
11 years ago
0.2.5
11 years ago
0.2.4
11 years ago
0.2.3
11 years ago
0.2.2
11 years ago
0.2.1
11 years ago
0.2.0
11 years ago
0.1.0
11 years ago
0.0.6
12 years ago
0.0.5
12 years ago
0.0.4
12 years ago
0.0.3
12 years ago
0.0.2
12 years ago
0.0.1
12 years ago