Skip to content

Zirql

A Rust library for pipelines, programs and comprehensions over native data.

Zirql is a Rust library for query languages over native data. A host supplies the data and its domain operations. Zirql evaluates pipelines, programs and comprehensions, keeping native results available to the caller.

The examples start with a small word host. It splits birch apple ash apple into borrowed words in source order and defines prefix("a") as an exact, case-sensitive prefix test. Repeated words remain separate stream entries.

filter(prefix("a")) | head(1) | count

Filtering keeps apple, ash, apple. Taking the first leaves apple, so the result is Count(1). The words still borrow the source text. The host implements prefix; Zirql supplies filtering, ordering, truncation and count.

Changing the stage order changes which words reach the filter:

Pipeline Returned words
filter(prefix("a")) | head(2) apple, ash
head(2) | filter(prefix("a")) apple

These are native streams. A caller can inspect them directly or ask its host to render them. Zirql does not choose an output format.

After a host explicitly projects the selected words to the string array ["apple", "ash", "apple"], a comprehension can construct labelled records. Written as expression-tree notation:

[{word: w, label: "word:" ++ w} for w in words]

The returned data, shown here as JSON, is:

[
{"word": "apple", "label": "word:apple"},
{"word": "ash", "label": "word:ash"},
{"word": "apple", "label": "word:apple"}
]

The worked examples explain the word model and these results. The common text reader accepts the pipelines above. Comprehensions use the Rust value representation; a frontend supplies their text syntax.

  • Language reference explains pipelines, predicates, programs, values and evaluation limits.
  • Examples follows words through queries to native results and constructed data. Design examples use the same small domain to explain unimplemented language forms.
  • Embedding in Rust explains what an integration needs. Getting started has a pinned dependency and a runnable scalar expression.

Semantic model integrations shows how Zincite and Zirium adapt the shared evaluator to source selections and operation handles. Their predicates, syntax, identity rules and renderers belong to those hosts.

For Rust signatures, use cargo doc --open for your pinned revision. docs.rs covers published versions.

Zirql is developed by Mikael Zayenz Lagerkvist. Source on GitHub · MIT OR Apache-2.0