data2level
v1.0.0
Published
Insert data to level db with auto generating keys.
Downloads
7
Readme
data2level
npm install data2level --save
Writer
Insert data to level db with auto generating keys.
var Writer = require('data2level').Writer
, data = [
{ ID: 1:, name: 'UnitA', result: 56 }
, { ID: 1:, name: 'UnitB', result: 54}
, { ID: 2:, name: 'UnitA', result: 67}
]
, keys = [ 'ID', 'name' ]
, writer
;
writer = new Writer({
'db': './db/data'
});
writer.write(data, keys, callback );
gets in the database like this:
{
'1\x00UnitA': { ID: 1:, name: 'UnitA', result: 56 },
'1\x00UnitB': { ID: 1:, name: 'UnitB', result: 56 },
'2\x00UnitA': { ID: 2:, name: 'UnitA', result: 56 }
}