Skip to content

Repository files navigation

cql2-rs

CI

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

Usage

API

[dependencies]
cql2 = "*"

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

  • Identifiers in output are quoted only where the cql2-text grammar requires it
  • 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 only where grouping requires them, so the output re-parses to the same expression

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.

About

Rust library and Python bindings for parsing the OGC CQL2 filter language

Resources

Code of conduct

Contributing

Stars

23 stars

Watchers

4 watching

Forks

Releases

Used by

Contributors

Languages