From 1fbe679adb6fb53fd56fe63622fb1eacdb533099 Mon Sep 17 00:00:00 2001 From: wangkai Date: Sat, 25 Feb 2023 17:27:57 +0800 Subject: [PATCH] fixed cb6d6a6 from https://gitee.com/wangkai0102/docs/pulls/15248 creatKvManager change Signed-off-by: wangkai --- .../database/database-mdds-guidelines.md | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/zh-cn/application-dev/database/database-mdds-guidelines.md b/zh-cn/application-dev/database/database-mdds-guidelines.md index 25132df1c0..0ea006bb5f 100644 --- a/zh-cn/application-dev/database/database-mdds-guidelines.md +++ b/zh-cn/application-dev/database/database-mdds-guidelines.md @@ -13,7 +13,7 @@ | 接口名称 | 描述 | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>): void
createKVManager(config: KVManagerConfig): Promise<KVManager> | 创建一个`KVManager`对象实例,用于管理数据库对象。 | +| createKVManager(config: KVManagerConfig): KVManager | 创建一个`KVManager`对象实例,用于管理数据库对象。 | | getKVStore<T extends KVStore>(storeId: string, options: Options, callback: AsyncCallback<T>): void
getKVStore<T extends KVStore>(storeId: string, options: Options): Promise<T> | 指定`Options`和`storeId`,创建并获取指定类型`KVStore`数据库。 | | put(key: string, value: Uint8Array\|string\|number\|boolean, callback: AsyncCallback<void>): void
put(key: string, value: Uint8Array\|string\|number\|boolean): Promise<void> | 插入和更新数据。 | | delete(key: string, callback: AsyncCallback<void>): void
delete(key: string): Promise<void> | 删除数据。 | @@ -117,16 +117,10 @@ bundleName: 'com.example.datamanagertest', context:context, } - distributedKVStore.createKVManager(kvManagerConfig, function (err, manager) { - if (err) { - console.error(`Failed to createKVManager.code is ${err.code},message is ${err.message}`); - return; - } - console.log('Succeeded in creating KVManager'); - kvManager = manager; - }); + kvManager = distributedKVStore.createKVManager(kvManagerConfig); + console.log("Succeeded in creating KVManager"); } catch (e) { - console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); + console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`); } ``` -- GitLab