diff options
author | Andrew Shulaev <ddrone@google.com> | 2023-02-28 11:06:16 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-02-28 11:06:16 +0000 |
commit | 7f315a3f9707276bf39edb39eedcd9dd795c6099 (patch) | |
tree | b0f0865a7a9eac25305bc4d8106c98a452f7a925 | |
parent | 7a66b67faed54d3ad446a60e94f2bb7a69899882 (diff) | |
parent | f0db0b9f9a5f4862c3f00e00ac9fce921b3da9eb (diff) | |
download | perfetto-7f315a3f9707276bf39edb39eedcd9dd795c6099.tar.gz |
Merge "Rename `where` to `filters`"
-rw-r--r-- | ui/src/frontend/sql_utils.ts | 6 | ||||
-rw-r--r-- | ui/src/frontend/sql_utils_unittest.ts | 4 | ||||
-rw-r--r-- | ui/src/frontend/thread_state.ts | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/ui/src/frontend/sql_utils.ts b/ui/src/frontend/sql_utils.ts index ff6e200ea..422e70fd1 100644 --- a/ui/src/frontend/sql_utils.ts +++ b/ui/src/frontend/sql_utils.ts @@ -21,7 +21,7 @@ interface OrderClause { // Interface for defining constraints which can be passed to a SQL query. export interface SQLConstraints { - where?: string[]; + filters?: string[]; orderBy?: OrderClause[]; limit?: number; } @@ -30,8 +30,8 @@ export interface SQLConstraints { // SQL query. export function constraintsToQueryFragment(c: SQLConstraints): string { const result: string[] = []; - if (c.where && c.where.length > 0) { - result.push(`WHERE ${c.where.join(' and ')}`); + if (c.filters && c.filters.length > 0) { + result.push(`WHERE ${c.filters.join(' and ')}`); } if (c.orderBy && c.orderBy.length > 0) { const orderBys = c.orderBy.map((clause) => { diff --git a/ui/src/frontend/sql_utils_unittest.ts b/ui/src/frontend/sql_utils_unittest.ts index d8e35bad6..0e5dc7688 100644 --- a/ui/src/frontend/sql_utils_unittest.ts +++ b/ui/src/frontend/sql_utils_unittest.ts @@ -21,7 +21,7 @@ function normalize(s: string): string { test('constraintsToQueryFragment: where', () => { expect(normalize(constraintsToQueryFragment({ - where: ['ts > 1000', 'dur != 0'], + filters: ['ts > 1000', 'dur != 0'], }))).toEqual('WHERE ts > 1000 and dur != 0'); }); @@ -37,7 +37,7 @@ test('constraintsToQueryFragment: limit', () => { test('constraintsToQueryFragment: all', () => { expect(normalize(constraintsToQueryFragment({ - where: ['id != 1'], + filters: ['id != 1'], orderBy: [{fieldName: 'ts'}], limit: 1, }))).toEqual('WHERE id != 1 ORDER BY ts LIMIT 1'); diff --git a/ui/src/frontend/thread_state.ts b/ui/src/frontend/thread_state.ts index 4513c5583..1a4f558b5 100644 --- a/ui/src/frontend/thread_state.ts +++ b/ui/src/frontend/thread_state.ts @@ -125,7 +125,7 @@ export async function getThreadStateFromConstraints( export async function getThreadState( engine: EngineProxy, id: number): Promise<ThreadState|undefined> { const result = await getThreadStateFromConstraints(engine, { - where: [`id=${id}`], + filters: [`id=${id}`], }); if (result.length > 1) { throw new Error(`thread_state table has more than one row with id ${id}`); |