Skip to content

Commit

Permalink
Allow for case-insensitive symcode query parameter (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
0237h authored Aug 16, 2024
1 parent eab70c0 commit 5d6eaf3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ export async function makeUsageQuery(ctx: Context, endpoint: UsageEndpoints, use
// Don't add `limit` and `block_range` to WHERE clause
for (const k of Object.keys(query_params).filter(k => k !== "limit" && k !== "block_range" && k !== "chain")) {
const clickhouse_type = typeof query_params[k as keyof typeof query_params] === "number" ? "int" : "String";
filters += ` (${k} = {${k}: ${clickhouse_type}}) AND`;
if (k === 'symcode') // Special case to allow case-insensitive symcode input
filters += ` (${k} = upper({${k}: ${clickhouse_type}})) AND`;
else
filters += ` (${k} = {${k}: ${clickhouse_type}}) AND`;
}

filters = filters.substring(0, filters.lastIndexOf(' ')); // Remove last item ` AND`
Expand Down

0 comments on commit 5d6eaf3

Please sign in to comment.