helix-dsl-macros
Procedural macros for the helix-dsl query registration system.
This crate provides the #[register] attribute macro, which transforms query-building functions into self-registering queries with compile-time parameter validation and runtime metadata.
Usage
use *;
The macro:
- Strips parameters from the function signature and replaces them with
letbindings toExpr::param(...), making them available as typed query expressions inside the body. - Generates a metadata function (
__helix_dsl_params_{name}) that returns aVec<QueryParameter>describing each parameter's name and type. - Registers the query via
inventoryas aRegisteredReadQueryorRegisteredWriteQuery, making it discoverable at runtime byhelix_db::generate().
Supported parameter types
| Rust type | Mapped to |
|---|---|
bool |
Bool |
i64 |
I64 |
f32 |
F32 |
f64 |
F64 |
String |
String |
Vec<u8> |
Bytes |
PropertyValue / ParamValue |
Value |
ParamObject / HashMap<String, T> / BTreeMap<String, T> |
Object |
Vec<T> |
Array(T) (recursive) |
Nested arrays are supported (e.g. Vec<Vec<f64>> maps to Array(Array(F64))).
Constraints
The macro rejects functions that are:
async- Generic (type parameters)
- Methods (have a
selfreceiver) - Using destructuring patterns in parameters
- Returning anything other than
ReadBatchorWriteBatch
License
Apache-2.0