refactor: rename DTree to DValue
This commit is contained in:
@@ -24,7 +24,7 @@ ws_message
|
||||
ws_connection_id
|
||||
ws_connections
|
||||
ws_send
|
||||
0_DTree
|
||||
0_DValue
|
||||
StringMap
|
||||
UploadedFile
|
||||
|
||||
@@ -120,7 +120,7 @@ Raw request body. For WebSocket handlers, this is the current message payload.
|
||||
Use this for JSON APIs:
|
||||
|
||||
```cpp
|
||||
DTree body = json_decode(context.in);
|
||||
DValue body = json_decode(context.in);
|
||||
```
|
||||
|
||||
### `context.uploaded_files`
|
||||
@@ -165,7 +165,7 @@ Related helpers:
|
||||
|
||||
### `context.call`
|
||||
|
||||
Type: `DTree`
|
||||
Type: `DValue`
|
||||
|
||||
General request-local scratch/configuration tree. It is shared by the page, components, and unit calls participating in the current request. Use it for app-level request state, fragments, router results, page type, page title, and other values that need to be read by later components.
|
||||
|
||||
@@ -181,7 +181,7 @@ Prefer clear top-level names when state is app-wide (`route`, `fragments`) and n
|
||||
|
||||
### `context.cfg`
|
||||
|
||||
Type: `DTree`
|
||||
Type: `DValue`
|
||||
|
||||
Request-local structured configuration. The runtime does not fill this with application config by default; application code may assign it during boot/setup:
|
||||
|
||||
@@ -199,19 +199,19 @@ String site_name = context.cfg.get_by_path("site/name").to_string();
|
||||
|
||||
### `context.props`
|
||||
|
||||
Type: `DTree`
|
||||
Type: `DValue`
|
||||
|
||||
Invocation-local props for `component()`, `component_render()`, and macro-style `unit_call()` entrypoints. During a component call, the runtime temporarily replaces `context.props` with the props passed to that component and restores the previous value after the call returns.
|
||||
|
||||
```cpp
|
||||
DTree props;
|
||||
DValue props;
|
||||
props["title"] = "Dashboard";
|
||||
print(component("components/card", props, context));
|
||||
```
|
||||
|
||||
### `context.connection`
|
||||
|
||||
Type: `DTree`
|
||||
Type: `DValue`
|
||||
|
||||
WebSocket connection-local state. Mutations persist across `WS(Request& context)` calls for the same socket.
|
||||
|
||||
@@ -394,7 +394,7 @@ RENDER(Request& context)
|
||||
RENDER(Request& context)
|
||||
{
|
||||
context.header["Content-Type"] = "application/json";
|
||||
DTree response;
|
||||
DValue response;
|
||||
response["ok"].set_bool(true);
|
||||
print(json_encode(response));
|
||||
}
|
||||
@@ -413,7 +413,7 @@ RENDER(Request& context)
|
||||
### Component props
|
||||
|
||||
```cpp
|
||||
DTree props;
|
||||
DValue props;
|
||||
props["title"] = "Welcome";
|
||||
print(component("components/card", props, context));
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user