Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #675 from EOSIO/table-key-deprecated
Browse files Browse the repository at this point in the history
Removing usages of deprecated table_key
  • Loading branch information
Brad Hart authored Feb 5, 2020
2 parents 489474c + 1035c22 commit 80a6d9c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/how-to-guides/09_how-to-get-table-information.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Above we console log the response from the EOSIO network. An example of an expe
```

## Query By Secondary Index
Finally, the `lower_bound` parameter can be used in conjunction with the `table_key` parameter to query an index different from the primary key.
Finally, the `lower_bound` parameter can be used in conjunction with the `index_position` parameter to query an index different from the primary key.

In the example shown below, the `contract` smart contract's table `profiles` is queried with the scope `contract` for the rows with secondary index `age` equal to **21**. The `limit` is **1** which implies that only 1 row with the age **21** will be returned.
```javascript
Expand All @@ -80,7 +80,7 @@ In the example shown below, the `contract` smart contract's table `profiles` is
code: 'contract', // Contract that we target
scope: 'contract', // Account that owns the data
table: 'profiles', // Table name
table_key: 'age', // Table secondary key name
index_position: 2, // Table secondary index
lower_bound: 21, // Table secondary key value
limit: 1, // Here we limit to 1 to get only row
reverse: false, // Optional: Get reversed data
Expand Down
2 changes: 0 additions & 2 deletions src/eosjs-jsonrpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ export class JsonRpc implements AuthorityProvider, AbiProvider {
code,
scope,
table,
table_key = '',
lower_bound = '',
upper_bound = '',
index_position = 1,
Expand All @@ -154,7 +153,6 @@ export class JsonRpc implements AuthorityProvider, AbiProvider {
code,
scope,
table,
table_key,
lower_bound,
upper_bound,
index_position,
Expand Down
6 changes: 1 addition & 5 deletions src/tests/eosjs-jsonrpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,10 @@ describe('JSON RPC', () => {
const code = 'morse';
const scope = 'minty';
const table = 'coffee';
const tableKey = 'front_door';
const lowerBound = 'zero';
const upperBound = 'five';
const limit = 20;
const indexPosition = 1;
const indexPosition = 2;
const keyType = 'str';
const expReturn = { data: '12345' };
const reverse = false;
Expand All @@ -386,7 +385,6 @@ describe('JSON RPC', () => {
code,
scope,
table,
table_key: tableKey,
lower_bound: lowerBound,
upper_bound: upperBound,
index_position: indexPosition,
Expand Down Expand Up @@ -414,7 +412,6 @@ describe('JSON RPC', () => {
const code = 'morse';
const scope = 'minty';
const table = 'coffee';
const tableKey = '';
const lowerBound = '';
const upperBound = '';
const limit = 10;
Expand All @@ -434,7 +431,6 @@ describe('JSON RPC', () => {
code,
scope,
table,
table_key: tableKey,
lower_bound: lowerBound,
upper_bound: upperBound,
index_position: indexPosition,
Expand Down

0 comments on commit 80a6d9c

Please sign in to comment.