Orbit.js数据访问和同步标准库
Orbit.js 是一个标准库用于数据访问和同步。Orbit 依赖于 Promises、Events 和底层转换。
简单示例:
// Create data sources with a common schema var schema = { idField: '__id', models: { planet: { } } }; var memorySource = new Orbit.MemorySource(schema); var restSource = new Orbit.JSONAPISource(schema); var localSource = new Orbit.LocalStorageSource(schema); // Connect MemorySource -> LocalStorageSource (using the default blocking strategy) var memToLocalConnector = new Orbit.TransformConnector(memorySource, localSource); // Connect MemorySource <-> JSONAPISource (using the default blocking strategy) var memToRestConnector = new Orbit.TransformConnector(memorySource, restSource); var restToMemConnector = new Orbit.TransformConnector(restSource, memorySource); // Add a record to the memory source memorySource.add('planet', {name: 'Jupiter', classification: 'gas giant'}).then( function(planet) { console.log('Planet added - ', planet.name, '(id:', planet.id, ')'); } ); // Log the transforms in all sources memorySource.on('didTransform', function(operation, inverse) { console.log('memorySource', operation); }); localSource.on('didTransform', function(operation, inverse) { console.log('localSource', operation); }); restSource.on('didTransform', function(operation, inverse) { console.log('restSource', operation); }); // CONSOLE OUTPUT // // memorySource {op: 'add', path: 'planet/1', value: {__id: 1, name: 'Jupiter', classification: 'gas giant'}} // localSource {op: 'add', path: 'planet/1', value: {__id: 1, name: 'Jupiter', classification: 'gas giant'}} // restSource {op: 'add', path: 'planet/1', value: {__id: 1, id: 12345, name: 'Jupiter', classification: 'gas giant'}} // memorySource {op: 'add', path: 'planet/1/id', value: 12345} // localSource {op: 'add', path: 'planet/1/id', value: 12345} // Planet added - Jupiter (id: 12345)
评论
libgda数据访问层库
libgda(GNOME-DB)是一个很好的数据访问层库,内部有sqlparser,元数据存储通过内部的sqlite实现,同时提供了对多种数据库后端的接入,sqlparser可以有较大用处。
libgda数据访问层库
0
libsync网络数据同步开发库
libsync是一个用于网络数据同步的开发库。假设现在有两台计算机Alpha和Beta,计算机Alpha能够访问A文件,计算机Beta能够访问B文件,文件A和B非常相似,计算机Alpha和Beta通过
libsync网络数据同步开发库
0
JTOpenIBM i 数据和资源访问的Java类库
IBMToolboxforJava是一个Java类库,支持针对IBMi的客户机/服务器和Internet编程模型。Javaapplets、servlets和应用程序可以使用这些类轻松访问IBMi数据和
JTOpenIBM i 数据和资源访问的Java类库
0