Skip to main content

Module schema

Module schema 

Source
Expand description

Schema 管理(对应 JS src/schema.js)

与 JS 版的差异:注册表由模块级全局 _schemas 改为显式 Registry 实例。

文件组织:数据结构与字段规范化在 [definition],注册/定位/配置在 [registry]。 对外 API(Registry / Schema / FieldDef / RelationDef / ComputeDef / map_of) 由本模块统一再导出,拆分不改语义。

Structs§

ComputeDef
FieldDef
LoadConfig
装载配置(store.config.json 的 sources + defs)
Location
落点:定义之外,由「目录语义 + 连接配置」解析得到(设计 §5.2)。 落点维度 = source + database + schema(schema 仅 PostgreSQL)。
Registry
RelationDef
Schema
SourceDecl
一个连接声明(store.config.json 的 sources 一项)

Enums§

Profile
查询档位:判决唯一在 core(照 Registry::require_context 既有范式)。

Functions§

depth_layered
语义层级深度:PG=2(L2=schema),Mongo/MySQL/SQLite=1(L2+ 打平)。 kind 非法 ⇒ Err(禁回落默认)。
locate
由「db 目录以下的相对路径」算落点(设计 §5.2 固定语义,D3):
map_of
便捷构造:Map from [(&str, Value)]
plan_load
纯批次规划(设计 §5.2 伪码 + §5.3 主从): files: [(rel_from_defs_root, defn)](rel 首段 = db 目录名)。