lisa.sync

1.2.4 • Public • Published

LiSA.sync

sync framework for node
LiSA.sync 默认的采用 fileAdapter
使用不同的adapter时请参考示例

phil(哲学)

phil

use

use with lisa.sync.fileadapter

npm i --save lisa.sync
var LiSASync = require('lisa.sync')

var LiSA = LiSASync(__dirname + '/test/LiSA.json',{internal : 2000})

console.log(LiSA.getSync())

LiSA.set({ name : "LiSA1" , gender : "girl"})

console.log(LiSA.getSync())

var index =0

LiSA.sync(()=>{
    return {
        name : "LiSA2"
    }
})

console.log(LiSA.getSync())

//you can call sync 
LiSA.sync(data=>{
    data.oneNode = { name : "testNode"}
})

LiSA.get().then(d=>{
    console.log(d)
})

//stop sync
LiSA.stop()

how to diy your adapter

exports.getId = (D)=>{}
exports.syncReader = (D) =>{}
exports.reader = (D)=>{}
exports.writer = (D,data)=>{}

use your adapter

var LiSASync = require('lisa.sync')

var yourAdapter = require('yourAdapterPath')

var LiSA = LiSASync(__dirname + '/test/LiSA.json',{internal : 2000} , yourAdapter)

just have a peek on lisa.sync.fileadapter
aok adapter aok
csv adapter csv

Readme

Keywords

none

Package Sidebar

Install

npm i lisa.sync

Weekly Downloads

0

Version

1.2.4

License

MIT

Unpacked Size

9.62 kB

Total Files

7

Last publish

Collaborators

  • apporoad