diff --git a/AppScope/app.json5 b/AppScope/app.json5 index fcfd6f8183dbe8f9e7ce51e7830870c6217f8f9b..074491ba3689f1b1b3c81bb1a6b032c33de5a455 100644 --- a/AppScope/app.json5 +++ b/AppScope/app.json5 @@ -3,7 +3,7 @@ "bundleName": "cn.openharmony.dataorm", "vendor": "example", "versionCode": 1000000, - "versionName": "2.0.3", + "versionName": "2.1.0", "icon": "$media:app_icon", "label": "$string:app_name", "distributedNotificationEnabled": true diff --git a/CHANGELOG.md b/CHANGELOG.md index 62c14e2259bc13cf87b23171885e9a6dfe23aca1..55406ab3857feca3a47340ef447b1722a3bdc8d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.0.4 +## 2.1.0 - 适配ArkTS语法 - globalThis全局设置更改单例模式GlobalContext设置 diff --git a/README.md b/README.md index e69ea8bdd38b2c9ff157769f49c6a5fe87591011..6a63a8c512204496cc0954f48d63cd60db5a3225 100644 --- a/README.md +++ b/README.md @@ -552,6 +552,8 @@ deleteQuery.executeDeleteWithoutDetachingEntities() ## 约束与限制 +- DevEco Studio: 4.0 Release(4.0.3.513), SDK: API10 (4.0.10.10) + - DevEco Studio 版本:4.0 Release(4.0.3.418),OpenHarmony SDK:(4.0.10.6) ## 目录结构 diff --git a/build-profile.json5 b/build-profile.json5 index 143ed0ba9efb2c77f81ee427406b1bb71415c60f..bdbc7dc1b1618dc47c4fa60e775ec045441ac246 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -1,12 +1,11 @@ { "app": { - "signingConfigs": [], - "compileSdkVersion": 10, - "compatibleSdkVersion": 10, "products": [ { "name": "default", "signingConfig": "default", + "compileSdkVersion": 10, + "compatibleSdkVersion": 10 } ] }, diff --git a/dataORM/index.ets b/dataORM/index.ts similarity index 100% rename from dataORM/index.ets rename to dataORM/index.ts diff --git a/dataORM/oh-package.json5 b/dataORM/oh-package.json5 index 12671ca6d21b4b153571aeab1e7d992e8eb39906..be69c0d64e8b548c6009454a6f5a14201bc6a41c 100644 --- a/dataORM/oh-package.json5 +++ b/dataORM/oh-package.json5 @@ -11,10 +11,10 @@ "ohos": { "org": "opensource" }, - "main": "index.ets", + "main": "index.ts", "repository": "https://gitee.com/openharmony-sig/dataORM", "type": "module", - "version": "2.0.4", + "version": "2.1.0", "dependencies": { "reflect-metadata": "^0.1.13" }, diff --git a/entry/oh-package.json5 b/entry/oh-package.json5 index 2be70f4a71869fe4b4c0e2be7cf071aed4964989..d89373a9a313476dc42cc2ebe43e916f30bc3f41 100644 --- a/entry/oh-package.json5 +++ b/entry/oh-package.json5 @@ -10,7 +10,7 @@ }, "description": "example description", "repository": {}, - "version": "2.0.3", + "version": "2.1.0", "dependencies": { "@ohos/dataorm": "file:../dataORM" } diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 2caca8d6af990aa6fa0a928aa53acec7a8b888a8..3c77353768bf28617b815c0451039ac7478f1dd1 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -26,6 +26,7 @@ import { Toolbar } from './toolbar' import { Note } from './Note' import { NoteType } from './NoteType' import dataRdb from '@ohos.data.relationalStore'; +import { QueryTest } from './util' @Entry @Component @@ -137,31 +138,15 @@ struct Index { .height(45) .fontSize(12) .layoutWeight(1) - .onClick((event: ClickEvent | undefined) => { - new inquiry().from(Note) - .eq("ID", 2) - .querySingle(Note) - .then((data: Array) => { - if (data) - this.arr = data; - else - this.arr = []; - }) + .onClick(async (event: ClickEvent | undefined) => { + this.arr = await QueryTest("ID", 2) }) Button('query aaa') .height(45) .fontSize(12) .layoutWeight(1) - .onClick((event: ClickEvent | undefined) => { - new inquiry().from(Note) - .eq("TEXT", "aaa") - .querySingle(Note) - .then((data: Array) => { - if (data) - this.arr = data; - else - this.arr = []; - }) + .onClick(async (event: ClickEvent | undefined) => { + this.arr = await QueryTest("TEXT", "aaa") }) }.padding({ top: 4, left: 10 }) .height('10%') diff --git a/entry/src/main/ets/pages/util.ts b/entry/src/main/ets/pages/util.ts new file mode 100644 index 0000000000000000000000000000000000000000..02487e4953be396598417c8d30c34d0900ff7491 --- /dev/null +++ b/entry/src/main/ets/pages/util.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { inquiry } from '@ohos/dataorm' +import { Note } from './Note' +export async function QueryTest(str1, str2) { + let arr + await new inquiry().from(Note) + .eq(str1, str2) + .querySingle(Note) + .then((data: Array) => { + if (data) + arr = data; + else + arr = []; + }) + + return arr +} \ No newline at end of file diff --git a/entry/src/ohosTest/ets/test/Ability.test.ets b/entry/src/ohosTest/ets/test/Ability.test.ets index 7ec6cdf1e9975aab33f8344417e6a088066d7936..452e7dd6cbfee74e13fc6db64aaceafcc1f73375 100644 --- a/entry/src/ohosTest/ets/test/Ability.test.ets +++ b/entry/src/ohosTest/ets/test/Ability.test.ets @@ -28,6 +28,7 @@ import { DaoMaster } from '@ohos/dataorm' import { Migration, ColumnType } from '@ohos/dataorm' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import { inquiry } from '@ohos/dataorm' +import { QueryTest } from '../../../main/ets/pages/util' interface entityClass {} @@ -426,12 +427,8 @@ export default function abilityTest() { note.setType(NoteType[NoteType.TEXT]) noteDao.insert(note) - new inquiry().from(Note) - .eq("TEXT", "abc") - .querySingle(Note) - .then((data: Array) => { - expect(data.length).assertEqual(1) - }) + let arr: Array = await QueryTest("TEXT", "abc") + expect(arr.length).assertEqual(1) }) }) }) diff --git a/hvigor/hvigor-config.json5 b/hvigor/hvigor-config.json5 index ec2a3ae0df3882488dc4c82e947a40f7eae1da15..a7403917020ccfee40077574d65a2ffc2c9ea481 100644 --- a/hvigor/hvigor-config.json5 +++ b/hvigor/hvigor-config.json5 @@ -1,6 +1,6 @@ { - "hvigorVersion": "2.4.2", - "dependencies": { - "@ohos/hvigor-ohos-plugin": "2.4.2" + "hvigorVersion":"3.0.2", + "dependencies":{ + "@ohos/hvigor-ohos-plugin":"3.0.2" } } \ No newline at end of file diff --git a/oh-package.json5 b/oh-package.json5 index 229889399bbcfc2f1d8854fa486f1bfd44a14642..3cc1e66d3418e8d3f4df36ef8519e36384bafeeb 100644 --- a/oh-package.json5 +++ b/oh-package.json5 @@ -11,6 +11,6 @@ }, "description": "example description", "repository": {}, - "version": "2.0.3", + "version": "2.1.0", "dependencies": {} }