12 releases

0.3.7-beta.0 Mar 28, 2025
0.3.6 Mar 28, 2025
0.3.4 Feb 21, 2025
0.3.2 Dec 9, 2024
0.1.0 Oct 8, 2024

#47 in Geospatial

Download history 165/week @ 2024-12-11 229/week @ 2024-12-18 15/week @ 2024-12-25 237/week @ 2025-01-01 162/week @ 2025-01-08 66/week @ 2025-01-15 67/week @ 2025-01-22 185/week @ 2025-01-29 576/week @ 2025-02-05 695/week @ 2025-02-12 783/week @ 2025-02-19 525/week @ 2025-02-26 181/week @ 2025-03-05 403/week @ 2025-03-12 9/week @ 2025-03-19 371/week @ 2025-03-26

1,004 downloads per month
Used in 6 crates (2 directly)

MIT license

145KB
1.5K 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

~23–31MB
~482K SLoC