Skip to content

Commit

Permalink
enhancement: add reverse param to query method
Browse files Browse the repository at this point in the history
closes issue #46
  • Loading branch information
dafuga committed Jan 9, 2024
1 parent 2866c48 commit 75e5ad7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/contract/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface QueryParams {
to?: API.v1.TableIndexType | string | number
maxRows?: number
rowsPerAPIRequest?: number
reverse?: boolean
}

interface FieldToIndex {
Expand Down Expand Up @@ -123,6 +124,7 @@ export class Table<RowType = any> {
lower_bound: wrapIndexValue(params.from),
upper_bound: wrapIndexValue(params.to),
limit: params.rowsPerAPIRequest || this.defaultRowLimit,
reverse: params.reverse,
}

if (params.index) {
Expand Down Expand Up @@ -173,6 +175,7 @@ export class Table<RowType = any> {
index_position: params.index_position,
key_type: params.key_type,
json: false,
reverse: params.reverse,
}

if (params.index) {
Expand Down Expand Up @@ -259,6 +262,7 @@ export class Table<RowType = any> {
lower_bound: wrapIndexValue(params.from),
upper_bound: wrapIndexValue(params.to),
limit: params.rowsPerAPIRequest || this.defaultRowLimit,
reverse: params.reverse,
}

return new TableScopeCursor({
Expand Down

0 comments on commit 75e5ad7

Please sign in to comment.