awslabs / dynein

DynamoDB CLI written in Rust.
https://github.com/awslabs/dynein
Apache License 2.0
360 stars 37 forks source link

Implement sophisticated parser for query command #163

Closed StoneDot closed 5 months ago

StoneDot commented 1 year ago

We should offer the same parsing experience for the query command as the upd command implemented by #132.

For example, we should support the following ways.

dy query 13 --sort-key '= "12"'
dy query 13 --sort-key "= '12'"
dy query 13 --sort-key '= 12'
dy query 13 --sort-key '<=12'

Additionally, we should care about the type difference between the schema of the sort key and the provided value. If dynein detects these kinds of mistakes, dynein should raise the error and propose a way to fix these errors or fall back to legacy parsing.

For example, we assume that a table was created with a sort key of a string. The following value of --sort-key does not match the expected type.

dy query 13 --sort-key '= 12'

In this case, dynein should raise the error and propose the following command or automatically fallback.

dy query 13 --sort-key '= "12"'