提交 121e9b62 编写于 作者: W wangkai

分布式数据管理指导文档完善

Signed-off-by: Nwangkai <wangkai424@huawei.com>
上级 35a94086
......@@ -73,11 +73,26 @@
以下为创建分布式数据库管理器的代码示例:
```js
// FA模型获取context
import featureAbility from '@ohos.ability.featureAbility';
var context = null;
let context = featureAbility.getContext();
// Stage模型获取context
import AbilityStage from '@ohos.application.Ability'
var context = null;
class MainAbility extends Ability{
onWindowStageCreate(windowStage){
context = this.context;
}
}
let kvManager;
try {
const kvManagerConfig = {
bundleName: 'com.example.datamanagertest',
userInfo: {
context:context,
userId: '0',
userType: distributedData.UserType.SAME_USER_ID
}
......
......@@ -1008,7 +1008,7 @@ try {
}).catch((err) => {
console.log('getResultSet failed: ' + err);
});
const moved5 = resultSet.move();
const moved5 = resultSet.move(1);
console.log("move succeed:" + moved5);
} catch (e) {
console.log("move failed: " + e);
......@@ -1048,7 +1048,7 @@ try {
}).catch((err) => {
console.log('getResultSet failed: ' + err);
});
const moved6 = resultSet.moveToPosition();
const moved6 = resultSet.moveToPosition(1);
console.log("moveToPosition succeed: " + moved6);
} catch (e) {
console.log("moveToPosition failed: " + e);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册