提交 0e17395a 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 25306f71
# DataAbilityPredicates # DataAbilityPredicates
> **NOTE**<br/> > **NOTE**<br/>
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -17,7 +18,7 @@ import dataAbility from '@ohos.data.dataAbility'; ...@@ -17,7 +18,7 @@ import dataAbility from '@ohos.data.dataAbility';
createRdbPredicates(name: string, dataAbilityPredicates: DataAbilityPredicates): rdb.RdbPredicates createRdbPredicates(name: string, dataAbilityPredicates: DataAbilityPredicates): rdb.RdbPredicates
Creates an **RdbPredicates** object based on a **DataAbilityPredicates** object. Creates an **RdbPredicates** object from a **DataAbilityPredicates** object.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Core **System capability**: SystemCapability.DistributedDataManager.DataShare.Core
...@@ -69,8 +70,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type **Valu ...@@ -69,8 +70,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type **Valu
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.equalTo("NAME", "lisi")
predicates.equalTo("NAME", "lisi")
``` ```
...@@ -97,8 +97,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type **Valu ...@@ -97,8 +97,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type **Valu
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.notEqualTo("NAME", "lisi")
predicates.notEqualTo("NAME", "lisi")
``` ```
...@@ -119,8 +118,7 @@ Adds a left parenthesis to this **DataAbilityPredicates**. ...@@ -119,8 +118,7 @@ Adds a left parenthesis to this **DataAbilityPredicates**.
**Example** **Example**
```js ```js
let predicates = new dataAbilitylity.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.equalTo("NAME", "lisi")
predicates.equalTo("NAME", "lisi")
.beginWrap() .beginWrap()
.equalTo("AGE", 18) .equalTo("AGE", 18)
.or() .or()
...@@ -146,8 +144,7 @@ Adds a right parenthesis to this **DataAbilityPredicates**. ...@@ -146,8 +144,7 @@ Adds a right parenthesis to this **DataAbilityPredicates**.
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.equalTo("NAME", "lisi")
predicates.equalTo("NAME", "lisi")
.beginWrap() .beginWrap()
.equalTo("AGE", 18) .equalTo("AGE", 18)
.or() .or()
...@@ -173,8 +170,7 @@ Adds the OR condition to this **DataAbilityPredicates**. ...@@ -173,8 +170,7 @@ Adds the OR condition to this **DataAbilityPredicates**.
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.equalTo("NAME", "Lisa")
predicates.equalTo("NAME", "Lisa")
.or() .or()
.equalTo("NAME", "Rose") .equalTo("NAME", "Rose")
``` ```
...@@ -197,8 +193,7 @@ Adds the AND condition to this **DataAbilityPredicates**. ...@@ -197,8 +193,7 @@ Adds the AND condition to this **DataAbilityPredicates**.
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.equalTo("NAME", "Lisa")
predicates.equalTo("NAME", "Lisa")
.and() .and()
.equalTo("SALARY", 200.5) .equalTo("SALARY", 200.5)
``` ```
...@@ -227,8 +222,7 @@ Sets a **DataAbilityPredicates** object to match a string containing the specifi ...@@ -227,8 +222,7 @@ Sets a **DataAbilityPredicates** object to match a string containing the specifi
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.contains("NAME", "os")
predicates.contains("NAME", "os")
``` ```
...@@ -255,8 +249,7 @@ Sets a **DataAbilityPredicates** object to match a string that starts with the s ...@@ -255,8 +249,7 @@ Sets a **DataAbilityPredicates** object to match a string that starts with the s
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.beginsWith("NAME", "os")
predicates.beginsWith("NAME", "os")
``` ```
...@@ -283,8 +276,7 @@ Sets a **DataAbilityPredicates** object to match a string that ends with the spe ...@@ -283,8 +276,7 @@ Sets a **DataAbilityPredicates** object to match a string that ends with the spe
**Example** **Example**
``` ```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.endsWith("NAME", "se")
predicates.endsWith("NAME", "se")
``` ```
...@@ -310,8 +302,7 @@ Sets a **DataAbilityPredicates** object to match the field whose value is null. ...@@ -310,8 +302,7 @@ Sets a **DataAbilityPredicates** object to match the field whose value is null.
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.isNull("NAME")
predicates.isNull("NAME")
``` ```
...@@ -337,8 +328,7 @@ Sets a **DataAbilityPredicates** object to match the field whose value is not nu ...@@ -337,8 +328,7 @@ Sets a **DataAbilityPredicates** object to match the field whose value is not nu
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.isNotNull("NAME")
predicates.isNotNull("NAME")
``` ```
...@@ -365,8 +355,7 @@ Sets a **DataAbilityPredicates** object to match a string that is similar to the ...@@ -365,8 +355,7 @@ Sets a **DataAbilityPredicates** object to match a string that is similar to the
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.like("NAME", "%os%")
predicates.like("NAME", "%os%")
``` ```
...@@ -393,8 +382,7 @@ Sets a **DataAbilityPredicates** object to match the specified string. ...@@ -393,8 +382,7 @@ Sets a **DataAbilityPredicates** object to match the specified string.
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.glob("NAME", "?h*g")
predicates.glob("NAME", "?h*g")
``` ```
...@@ -422,8 +410,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type **Valu ...@@ -422,8 +410,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type **Valu
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.between("AGE", 10, 50)
predicates.between("AGE", 10, 50)
``` ```
...@@ -451,8 +438,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type **Valu ...@@ -451,8 +438,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type **Valu
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.notBetween("AGE", 10, 50)
predicates.notBetween("AGE", 10, 50)
``` ```
...@@ -479,8 +465,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type **Valu ...@@ -479,8 +465,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type **Valu
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.greaterThan("AGE", 18)
predicates.greaterThan("AGE", 18)
``` ```
...@@ -507,8 +492,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type **Valu ...@@ -507,8 +492,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type **Valu
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.lessThan("AGE", 20)
predicates.lessThan("AGE", 20)
``` ```
...@@ -535,8 +519,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type **Valu ...@@ -535,8 +519,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type **Valu
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.greaterThanOrEqualTo("AGE", 18)
predicates.greaterThanOrEqualTo("AGE", 18)
``` ```
...@@ -563,8 +546,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type **Valu ...@@ -563,8 +546,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type **Valu
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.lessThanOrEqualTo("AGE", 20)
predicates.lessThanOrEqualTo("AGE", 20)
``` ```
...@@ -590,8 +572,7 @@ Sets a **DataAbilityPredicates** object to match the column with values sorted i ...@@ -590,8 +572,7 @@ Sets a **DataAbilityPredicates** object to match the column with values sorted i
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.orderByAsc("NAME")
predicates.orderByAsc("NAME")
``` ```
...@@ -617,8 +598,7 @@ Sets a **DataAbilityPredicates** object to match the column with values sorted i ...@@ -617,8 +598,7 @@ Sets a **DataAbilityPredicates** object to match the column with values sorted i
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.orderByDesc("AGE")
predicates.orderByDesc("AGE")
``` ```
...@@ -639,14 +619,7 @@ Sets a **DataAbilityPredicates** object to filter out duplicate records. ...@@ -639,14 +619,7 @@ Sets a **DataAbilityPredicates** object to filter out duplicate records.
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.equalTo("NAME", "Rose").distinct()
predicates.equalTo("NAME", "Rose").distinct("NAME")
let promiseDistinct = rdbStore.query(predicates, ["NAME"])
promiseDistinct.then((resultSet) => {
console.log("distinct")
}).catch((err) => {
expect(null).assertFail();
})
``` ```
...@@ -672,8 +645,7 @@ Set a **DataAbilityPredicates** object to specify the maximum number of records. ...@@ -672,8 +645,7 @@ Set a **DataAbilityPredicates** object to specify the maximum number of records.
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.equalTo("NAME", "Rose").limitAs(3)
predicates.equalTo("NAME", "Rose").limitAs(3)
``` ```
...@@ -699,8 +671,7 @@ Sets a **DataAbilityPredicates** object to specify the start position of the ret ...@@ -699,8 +671,7 @@ Sets a **DataAbilityPredicates** object to specify the start position of the ret
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.equalTo("NAME", "Rose").offsetAs(3)
predicates.equalTo("NAME", "Rose").offsetAs(3)
``` ```
...@@ -726,8 +697,7 @@ Sets a **DataAbilityPredicates** object to group rows that have the same value i ...@@ -726,8 +697,7 @@ Sets a **DataAbilityPredicates** object to group rows that have the same value i
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.groupBy(["AGE", "NAME"])
predicates.groupBy(["AGE", "NAME"])
``` ```
### indexedBy ### indexedBy
...@@ -751,8 +721,7 @@ Sets a **DataAbilityPredicates** object to specify the index column. ...@@ -751,8 +721,7 @@ Sets a **DataAbilityPredicates** object to specify the index column.
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.indexedBy("SALARY_INDEX")
predicates.indexedBy("SALARY_INDEX")
``` ```
...@@ -780,8 +749,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type Array< ...@@ -780,8 +749,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type Array<
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.in("AGE", [18, 20])
predicates.in("AGE", [18, 20])
``` ```
...@@ -809,8 +777,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type Array< ...@@ -809,8 +777,7 @@ Sets a **DataAbilityPredicates** object to match the field with data type Array<
**Example** **Example**
```js ```js
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") dataAbilityPredicates.notIn("NAME", ["Lisa", "Rose"])
predicates.notIn("NAME", ["Lisa", "Rose"])
``` ```
## ValueType ## ValueType
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册