helix-ast 0.1.0

Shared Helix query AST and JSON wire contract for Helix SDKs
Documentation
  • Coverage
  • 91.28%
    775 out of 849 items documented4 out of 350 items with examples
  • Size
  • Source code size: 176.6 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 6.0 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • xav-db

Shared Helix query AST.

This crate owns the public JSON contract used by SDKs and the planner. The wire format is an operation tree: each traversal builder call creates one node, and chaining wraps the previous root as that node's input.

Modules define the stable contract boundaries:

  • [value] contains JSON/property values and mutation inputs.
  • [expr] contains predicates, expressions, and stream bounds.
  • [traversal] contains the operation-tree AST and traversal builders.
  • [batch] and [query] contain batch and request wire formats.
use helix_ast::prelude::*;

let query = read_batch()
    .var_as(
        "users",
        g()
            .n_with_label("User")
            .where_(Predicate::eq("username", "alice"))
            .limit(1),
    )
    .returning(["users"]);
let json = sonic_rs::to_string(&query).unwrap();

assert!(json.contains(r#""root":{"limit""#));
assert!(json.contains(r#""input":{"where""#));
assert!(json.contains(r#""eq":{"left":{"property":"username"}"#));