refactor: rename DTree to DValue

This commit is contained in:
udo
2026-06-12 11:05:52 +00:00
parent 941f5aea08
commit 7066da3cde
157 changed files with 1203 additions and 1074 deletions
+6 -6
View File
@@ -1,19 +1,19 @@
:sig
StringMap DTree::to_stringmap() const
StringMap DValue::to_stringmap() const
:params
return value : a flat `StringMap` projection of the node
:see
>types
0_DTree
0_DValue
StringMap
to_string
dtree_keys
dtree_values
dv_keys
dv_values
:content
Converts a `DTree` into a flat `StringMap`. This is a read accessor: it is `const`, never creates or modifies nodes, and dereferences internal references automatically.
Converts a `DValue` into a flat `StringMap`. This is a read accessor: it is `const`, never creates or modifies nodes, and dereferences internal references automatically.
- Map-shaped nodes produce one entry per child, with each child read via `to_string()`. Nested maps flatten to empty strings — this is a one-level projection, not a serializer.
- A non-empty scalar produces a single `"value"` entry holding the scalar.
@@ -25,7 +25,7 @@ Use this when handing request- or config-shaped data to APIs that take `StringMa
```cpp
StringMap params = context.props["filters"].to_stringmap();
DTree rows = sqlite_query(db, "select * from notes where author = :author", params);
DValue rows = sqlite_query(db, "select * from notes where author = :author", params);
```
For a faithful representation of nested data, use `json_encode()` instead.