6 releases

0.3.3-alpha.0 Feb 3, 2025
0.3.2 Dec 9, 2024
0.3.1 Nov 14, 2024
0.3.0 Oct 14, 2024
0.1.0 Oct 8, 2024

#289 in Database interfaces

Download history 12/week @ 2024-10-21 22/week @ 2024-10-28 81/week @ 2024-11-04 206/week @ 2024-11-11 341/week @ 2024-11-18 125/week @ 2024-11-25 154/week @ 2024-12-02 279/week @ 2024-12-09 182/week @ 2024-12-16 125/week @ 2024-12-23 209/week @ 2024-12-30 127/week @ 2025-01-06 95/week @ 2025-01-13 92/week @ 2025-01-20 65/week @ 2025-01-27 651/week @ 2025-02-03

906 downloads per month
Used in 6 crates (2 directly)

MIT license

125KB
1K SLoC

cql2-rs

CI

Parse, validate, and convert Common Query Language (CQL2) text and JSON.

Usage

API

[dependencies]
cql = "0.3"

Then:

use cql2::Expr;

let expr: Expr = "landsat:scene_id = 'LC82030282019133LGN00'".parse().unwrap();
assert!(expr.is_valid());
println!("{}", expr.to_json().unwrap());

See the documentation for more.

CLI

See the cql2-cli README for details.

Responses

Responses may not match the input.

cql2-text differences

  • All identifiers in output are double quoted
  • The position of "NOT" keywords is standardized to be before the expression (ie "... NOT LIKE ..." will become "NOT ... LIKE ..."
  • The negative operator on anything besides a literal number becomes "* -1"
  • Parentheses are added around all expressions

Development

Get uv and Rust. Then:

git clone git@github.com:developmentseed/cql2-rs.git
cd cql2-rs
uv sync
scripts/test

To lint all files:

scripts/lint

To serve the docs locally:

uv run mkdocs serve  # http://127.0.0.1:8000/cql2-rs/

See CONTRIBUTING.md for more information about contributing to this project.

License

cql2-rs is licensed under the MIT license. See LICENSE for details.

Dependencies

~23MB
~405K SLoC