Skip to content

Commit

Permalink
<doc>(table): add select condition doc. (#1566)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyonRay committed Nov 7, 2022
1 parent 07ecefd commit 4dbe60d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion 3.x/zh_CN/docs/develop/console/console_commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ Update OK, 1 row affected.
运行delete sql语句删除记录,使用mysql语句形式。
```text
[group:1]> delete from t_demo where name = fruit and item_id = 1
[group:1]> delete from t_demo where name = fruit
Remove OK, 1 row affected.
```
Expand Down
27 changes: 25 additions & 2 deletions 3.x/zh_CN/docs/develop/precompiled/use_crud_precompiled.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,32 @@ function select(string memory id) public view returns (string memory,string memo
}
```

### 3. WBC-Liquid合约使用KVTable接口
#### 2.4 使用Condition读写多行数据

#### 3.1 声明KVTable接口
用户可以使用Table提供的具有Condition参数的接口,进行多行数据读写。

**注意:** 目前的Condition只支持主键字段的范围筛选。

读多行数据的核心代码如下,写多行数据的类似:

```solidity
function selectMore(string memory gt_id)
public
view
returns (Entry[] memory entries)
{
Condition[] memory conds = new Condition[](1);
Condition memory gt = Condition({op: ConditionOP.GT, value: gt_id});
conds[0] = gt;
Limit memory limit = Limit({offset: 0, count: 100});
entries = table.select(conds, limit);
return entries;
}
```

### 3. WBC-Liquid合约使用Table接口

#### 3.1 声明Table接口

在WBC-Liquid合约中使用接口之前先对KVTable的接口进行声明。

Expand Down

0 comments on commit 4dbe60d

Please sign in to comment.