Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: add support for comparsion operator to SearchPair #1580

Open
seleniumforest opened this issue Apr 18, 2024 · 0 comments
Open

Comments

@seleniumforest
Copy link

search.ts

export interface SearchPair {
  readonly key: string;
  readonly value: string | number | bigint;
  readonly comparsionOp?: ">" | ">=" | "<" | "<="
}

It will be useful, for example, when you want to find logs by composite key in range of blocks
(stargateclient.ts)

rawQuery = query
        .map((t) => {
          let compOp = t.comparsionOp || "="
          if (typeof t.value === "string") return `${t.key}${compOp}'${t.value}'`;
          else return `${t.key}${compOp}${t.value}`;
        })
        .join(" AND ");

Then client could use like this:

await searchTx([
  {key: "tx.height",  comparsionOp: ">" ,value: 10},
  {key: "tx.height",  comparsionOp: "<" ,value: 20},
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant