| Crates.io | toon_ql |
| lib.rs | toon_ql |
| version | 0.0.2 |
| created_at | 2025-11-17 04:02:15.065724+00 |
| updated_at | 2025-11-17 04:14:08.356153+00 |
| description | A query language for Toon data |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1936218 |
| size | 4,351 |
Toon Query Language extends the Toon format with embedded logic blocks that tell the AI how to process the data. These in-band conditions live alongside the data itself and guide how it should be parsed and interpreted.
⚠️ Early Development - This project is in active early development.
Toon-QL behaves like a mini preprocessor that sits inside the Toon document. It interleaves data and instructions so the consumer (human, AI assistant, or compiler) knows why certain rows appear and how they relate to the rest of the payload. Everything is declarative, so a Toon-QL interpreter could execute the script, or the same script could simply be given to an AI as instructions.
@pipe products (
@let $price = $0.price - $0.discount
@emit ProductRow {id,name,price}:
$0.id,$0.name,$price
)
Here, @pipe defines a block instruction, $price is a new variable, $0 is the current product in the loop, and @emit outputs the processed ProductRow.
This ToonQL pipeline iterates over products, computes lightweight variables with @let and emits Toon-ready rows with @emit <ObjectName> { ... }
@pipe products (
@if $0.price == 0 {
@emit ArchiveRow {id,name,reason}:
p.id,p.name,"skip product because price == 0"
@next
}
@emit ProductRow {id,name,price}:
p.id,p.name,p.price
)
This ToonQL pipeline iterates over products, sending any with price == 0 to an ArchiveRow with a skip reason and moving on, while emitting all other products as ProductRow records with their id, name, and price.
@pipeline orders (
@if $0.total > 1_00
@note "Verify billing address matches shipping before fulfillment."
@emit OrderRow{customer,total}:
order.customer_name,order.total
)
This ToonQL pipeline processes each order, inserting @note annotations that give the AI additional contextual guidance, and emitting an OrderRow with the customer name and formatted total, while using the notes to flag orders over 100 for address verification and to notify support when the final note appears.
Down the road the README will be updated with the actual interpreter, but for now these sketches are meant to lock down the ergonomics of Toon-QL.
Contributions are welcome! Feel free to submit issues and pull requests.